返回

'AppComponent' 类在 NgModule 'AppModule' 的声明中列出,但不是指令、组件或管道

发布时间:2022-08-01 17:33:51 342
# bootstrap# angular

这不是重复:Angular Compile Error: NG6001: 该类在 NgModule 'AppModule' 的声明中列出,但不是指令、组件或管道。

我正在尝试制作一个博客应用程序,但在我的 app.modules.ts vs 代码中显示此错误:

The class 'AppComponent' is listed in the declarations of the NgModule 'AppModule', but 
is not a directive, a component, or a pipe. Either remove it from the NgModule's 
declarations, or add an appropriate Angular decorator

我不知道这意味着什么。Firebase 版本是 8.2.6

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
import { getFirestore, provideFirestore, enableIndexedDbPersistence } from         '@angular/fire/firestore';
import { AngularFireModule } from "@angular/fire/compat";
import { AngularFirestoreModule } from '@angular/fire/compat/firestore';
import { articleComponent } from './article/article.component';
import { AppRoutingModule } from './app-routing.module';
import { TimelineComponent } from './timeline/timeline.component';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { AuthInterceptor } from "./services/auth.interceptor";
import { AllarticlesComponent } from './allarticles/allarticles.component';
import { HomeComponent } from './home/home.component';
import { LostComponent } from './lost/lost.component';

@NgModule({
  declarations: [
    AppComponent,
    articleComponent,
    TimelineComponent,
    AllarticlesComponent,
    HomeComponent,
    LostComponent,
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule,
    AngularFireModule.initializeApp(environment.firebase),
  ],
  providers: [
   
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像