使用下面的 angular 命令创建 layout-basic
ng g ng-zorro-antd:layout-basic layout --style less
build 时出现下面的错误
Error: src/app/layout/layout.component.html:2:5 - error NG8001: 'nz-layout' is not a known element
请问如何解决?
需要在 app.module.ts 中引用 NzLayoutModule
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LayoutComponent } from './layout/layout.component';
import { NzLayoutModule } from 'ng-zorro-antd/layout';
@NgModule({
declarations: [
AppComponent,
LayoutComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NzLayoutModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }