ERROR in:'组件选择器'不是一个已知的元素:在angular 5 app上运行ng-build

时间:2017-12-23 17:51:23

标签: angular typescript angular-ui-router

  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'此组件禁止此消息。 (" [错误 - >] &#34)

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']
   })

1 个答案:

答案 0 :(得分:2)

由于错误显示您需要在 app.module.ts 中添加该组件,因此我假设该名称为 AppAdminNavigationComponent

@NgModule({
  declarations: [
    AppComponent,
    AppAdminNavigationComponent
]