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

后端 未结 12 2098
陌清茗
陌清茗 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:52

    Importing both HttpModule and HttpClientModule helped me.

    import { HttpClientModule } from '@angular/common/http'; 
    import { HttpModule } from '@angular/http';
    

提交回复
热议问题