NodeInvocationException:无法解析CookieService的所有参数

时间:2019-10-31 13:12:00

标签: angular .net-core

当我在.net-core角度应用程序中添加“ ngx-cookie-service”时。 我正在面对这个问题

处理请求时发生未处理的异常。 NodeInvocationException:无法解析CookieService的所有参数:(?,[object Object])。 错误:无法解析CookieService的所有参数:(?,[object Object])。

import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule, FormGroup } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule, CanActivate, Routes } from '@angular/router';
import { AuthGuard } from '../app/components/Services/AuthGuard';
import { AuthService } from '../app/components/Services/authservice';
import { AppComponent } from './components/app/app.component';
import { LoginComponent } from './components/login/login.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { HomeComponent } from './components/home/home.component';
import { FetchDataComponent } from './components/fetchdata/fetchdata.component';
import { CounterComponent } from './components/counter/counter.component';
import { CookieService } from 'ngx-cookie-service';

const routes: Routes = [
    { path: '', redirectTo: 'home', pathMatch: 'full' },
    { path: 'login', component: LoginComponent },
    {
        path: 'home', component: HomeComponent,
        canActivate: [AuthGuard]
    },
    {
        path: 'counter', component: CounterComponent,
        canActivate: [AuthGuard] },
    {
        path: 'fetch-data', component: FetchDataComponent,
        canActivate: [AuthGuard] }

    { path: '**', redirectTo: 'home' },
]

@NgModule({
    declarations: [
        AppComponent,
        NavMenuComponent,
        CounterComponent,
        HomeComponent,
        LoginComponent
    ],
    providers:
        [
            AuthGuard, AuthService, CookieService
        ],
    imports: [
        CommonModule,
        HttpModule,
        FormsModule,
        ReactiveFormsModule,
        RouterModule.forRoot(routes)
    ]
})
export class AppModuleShared {
}

0 个答案:

没有答案