Javascript NG002错误:无法解析为NgModule类
我已将一个新组件添加到我的angular项目中,并确保已将其导入我的应用程序模块中,但我收到一个NG002错误,错误如下:Javascript NG002错误:无法解析为NgModule类,javascript,angular,typescript,Javascript,Angular,Typescript,我已将一个新组件添加到我的angular项目中,并确保已将其导入我的应用程序模块中,但我收到一个NG002错误,错误如下: error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. Is it missing an @NgModule annotation? export class NavigationBarDriverCompone
error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
export class NavigationBarDriverComponent {
我的应用程序模块如下所示:
从“@angular/platform browser”导入{BrowserModule};
从“@angular/core”导入{NgModule};
从'@angular/common/http'导入{HttpClientModule};
从“@agm/core”导入{GoogleMapsapiwraper};
从“./app.component”导入{AppComponent};
从“./button/button.component”导入{ButtonComponent};
从“@agm/core”导入{AgmCoreModule};
从“agm方向”导入{AgmDirectionModule};
从ngx google places自动完成导入{GooglePlacesModule};
从“./navigation bar/navigation bar.component”导入{NavigationBarComponent};
从“./navigation bar driver/navigation bar driver.component”导入{NavigationBarDriverComponent};
从'@angular/cdk/layout'导入{LayoutModule};
从“@angular/material/toolbar”导入{MatToolbarModule};
从“@angular/material/button”导入{MatButtonModule};
从'@angular/material/sidenav'导入{MatSidenavModule};
从“@angular/material/icon”导入{MatIconModule};
从'@angular/material/list'导入{MatListModule};
从“@angular/platform browser/animations”导入{NoopAnimationsModule};
从“ng pick datetime”导入{OwlDateTimeModule,OwlNativeDateTimeModule};
从“@angular/platform browser/animations”导入{BrowserAnimationsModule};
从“@angular/material/dialog”导入{MatDialogModule};
从“./route dialog/route dialog.component”导入{RouteDialogComponent};
从“./app routing.module”导入{AppRoutingModule,routingComponents};
@NGD模块{
声明:[
应用组件,
按钮组件,
导航栏组件,
导航组件,
路由模拟组件,
路由组件
],
进口:[
浏览器模块,
AgmCoreModule.forRoot{
apiKey:'AizasydnibzvtPaquvcrp9zyz5efgzncyk1jys'
},
AGMDirection模块,
GooglePlaceModule,
布局模块,
Mattoolbar模块,
MatButtonModule,
Matside导航模块,
Maticon模块,
MatListModule,
NoopAnimationsModule,
HttpClientModule,
OwlDateTimeModule,
OWLnativeDateTime模块,
BrowserAnimationsModule,
MatDialogModule,
MatButtonModule,
批准模块,
导航组件
],
提供者:[],
引导:[AppComponent]
}
导出类AppModule{}
我的导航组件如下所示:
从“@angular/core”导入{Component,NgModule};
从'@angular/cdk/layout'导入{BreakpointObserver,Breakpoints};
从“rxjs”导入{Observable};
从“rxjs/operators”导入{map,shareReplay};
@组成部分{
选择器:“应用程序导航栏驱动程序”,
templateUrl:'./导航栏驱动程序.component.html',
样式URL:['./导航栏驱动程序.component.css']
}
导出类导航组件{
抽屉
isHandset$:Observable=this.breakpoints.observeBreakpoints.Handset
管
mapresult=>result.matches,
共享重播
;
构造函数私有断点观察者:断点观察者{}
}
我尝试使用ng serve和ng serve-prod重新启动angular服务器,正如我在另一个线程中看到的那样。从应用程序模块导入中删除NavigationBarDriverComponent 从应用程序模块导入中删除NavigationBarDriverComponent