포착되지 않은 오류 : 'AppModule'모듈에서 예기치 않은 지시문 'NavComponent'를 가져 왔습니다. @NgModule 주석을 추가하십시오

사용자 10531494

내부에 사용자 정의 구성 요소 (nav)가 있습니다.

그것을 사용할 때 webpack 컴파일이 성공적으로 종료되지만 크롬에서 다음 오류가 발생합니다.

포착되지 않은 오류 : 'AppModule'모듈에서 예기치 않은 지시문 'NavComponent'를 가져 왔습니다. @NgModule 주석을 추가하십시오.

내 AppModule은 다음과 같습니다.

>

 import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { NavComponent } from './nav/nav.component';

@NgModule({
  declarations: [AppComponent ],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, NavComponent],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
Suren Srapyan

당신이 경우 NavComponentA는 @Component또는를 @Directive, 당신은에 추가해야 declarations하는 대신,imports

...
declarations: [ AppComponent, NavComponent ],
...

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관