Angular 6中的StaticInjectorError(AppModule)[AuthenticationService]

时间:2019-01-11 12:02:14

标签: angular angular6

我的角度项目中有3个模块 1. AppModule 2. AutheticationModule 3.门户模块 当我尝试运行项目时出现错误

AuthenticationService参考也已在Providers部分的app.module.ts中添加。我正在使用延迟加载进行路由。

在appModule的代码下方

providers: [
AuthenticationService,
AuthGuard,

我的Authentication.Routing.Module代码在下面

import { Routes } from '@angular/router';

import { LoginComponent } from './login/login.component';
import { SignupComponent } from './signup/signup.component';

export const AuthenticationRoutes: Routes = [
  {
    path: '',
    children: [
      {
        path: '',
        redirectTo: 'login',
        pathMatch: 'full'
      },
      {
        path: 'login',
        component: LoginComponent
      },
      {
        path: 'signup',
        component: SignupComponent
      }
    ]
  }
];

我的应用程序路由模块下面的代码

export const Approutes: Routes = [
  {
    path: '',
    component: BlankComponent,
    children: [
      {
        path: '',
        redirectTo: 'authentication',
        pathMatch: 'full'
      },
      {
        path: 'authentication',
        loadChildren:
          './portal/authentication/authentication.module#AuthenticationModule'
      }
    ]
  },
  {
    path: '',
    component: FullComponent,
    children: [
      {
        path: 'portal',
        loadChildren: './portal/portal.module#PortalModule'
      },
      { path: '', redirectTo: '', pathMatch: 'full' }
    ]
  },
  {
    path: '**',
    component: NotfoundComponent
  }
];

您能帮我解决问题吗?在提供商中添加服务后,我得到了错误。   enter image description here

0 个答案:

没有答案