错误输入('组件选择器'不是已知元素:在angular 5 app上运行ng-build)

须知少年凌云志,曾许人间第一流。这篇文章主要讲述错误输入:' 组件选择器' 不是已知元素:在angular 5 app上运行ng-build相关的知识,希望能为你提供帮助。

ERROR in : 'app-admin-navs' is not a known element:

1.如果'app-admin-navs'是Angular组件,请验证它是否是此模块的一部分。 2.如果'app-admin-navs'是Web组件,则将'CUSTOM_ELEMENTS_SCHEMA'添加到此组件的'@NgModule.schemas'以禁止显示此消息。 (“[错误 - > ]”)
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import {AuthenticationModule} from './authentication/authentication.module'; import { SelectModule } from 'ng-select'; import {FormsModule} from '@angular/forms'; import { RouterModule } from '@angular/router'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; // import { SharedModule } from './shared/shared.module'; // import {ProcessListService} from '././processflow/services/process-list.service'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { ReactiveFormsModule } from '@angular/forms'; @NgModule({ declarations: [ AppComponent, ], imports: [ BrowserModule, RouterModule, AppRoutingModule, FormsModule, ReactiveFormsModule, SelectModule, // Select2 NgbModule.forRoot(), // bootstrap AuthenticationModule, NoopAnimationsModule,// lazy load other modules. they are in shared module, lazy loaded by routes], providers: [ ], bootstrap: [AppComponent] }) export class AppModule { }< app-admin-navs> < /app-admin-navs> < router-outlet> < /router-outlet> @Component({ selector: 'app-admin-navs', templateUrl: './admin-navs.component.html', styleUrls: ['./admin-navs.component.css'] })

答案【错误输入(' 组件选择器' 不是已知元素:在angular 5 app上运行ng-build)】由于错误说您需要在app.module.ts中添加组件,我假设名称为AppAdminNavigationComponent
@NgModule({ declarations: [ AppComponent, AppAdminNavigationComponent ]


    推荐阅读