我正在尝试在我的角度应用程序上使用Firebase身份验证使用身份验证。为此,我创建了一个身份验证服务,身份验证防护和前端来登录/注册。不幸的是,我遇到以下错误:
NullInjectorError:R3InjectorError(AppModule)[AuthGuard-> AuthService-> AngularFireAuth-> AngularFireAuth-> AngularFireAuth]:
这是我的app.module:
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { UserProfileComponent } from './user-profile/user-profile.component';
import {AuthService} from './auth.service';
import {AuthGuard} from './auth.guard';
@NgModule({
declarations: [
AppComponent,
],
imports: [
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireAuthModule
// imports firebase/auth, only needed for auth features
],
providers: [ AngularFireAuthModule, AuthService, AuthGuard],
entryComponents: [LocationsFilterBottomSheetComponent, QrCodeBottomSheetComponent, FilterVouchersBottomSheetComponent],
bootstrap: [AppComponent]
})
export class AppModule {
}