“No provider for AuthGuard!” using CanActivate in Angular 2

后端 未结 12 2283
陌清茗
陌清茗 2021-02-03 20:09

EDIT : Obviously this is outdated, now you provide your guard at the providers array in an NgModule. Watch other answers or official documentation

12条回答
  •  忘掉有多难
    2021-02-03 20:32

    you can try import AuthGuard in provider of that module and then import it in the routing component-routing.module.ts file also

    @NgModule({
    providers: [
        AuthGuard
      ],})
    

提交回复
热议问题