在我的 app.module.ts 中
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
MaterialModule,
FlexLayoutModule,
BrowserAnimationsModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
MyAppModule
],
providers: [
AuthenticationService,
AuthGuardService,
MyAppService
],
bootstrap: [AppComponent]
})
export class AppModule { }
在我的 AuthGuardService 中:
@Injectable({
providedIn: 'root'
})
export class AuthGuardService implements CanActivate {
我已经将 HttpClientModule 放入我的 authguard 中,甚至添加了providIn,但我仍然遇到此错误。我正在使用角度7。
删除您已添加的提供商的所有服务providedIn: 'root'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)