StaticInjectorError[e -> e]: NullInjectorError: No provider for e

iPh*_*Dev 6 angular

在我的 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 { }
Run Code Online (Sandbox Code Playgroud)

在我的 AuthGuardService 中:

@Injectable({
  providedIn: 'root'
})
export class AuthGuardService implements CanActivate {
Run Code Online (Sandbox Code Playgroud)

我已经在我的 authguard 中放置了 HttpClientModule,甚至添加了 providedIn,但我仍然遇到这个错误。我正在使用角度 7。

Saj*_*ran 4

删除您已添加的提供商的所有服务providedIn: 'root'