引用NG-ZORRO,在使用nz-form时报错
- 使用NG-ZORRO官网案例 ,复制粘贴,还是报错,哭

-
解决办法
- 在对应的module文件中 引入
ReactiveFormsModule
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd'; //这里 import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpClientModule } from '@angular/common/http'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { registerLocaleData } from '@angular/common'; import zh from '@angular/common/locales/zh'; import { S1Component } from './components/s1/s1.component'; import { MyfComponent } from './components/myf/myf.component'; registerLocaleData(zh); @NgModule({ declarations: [ AppComponent, S1Component, MyfComponent ], imports: [ BrowserModule, NgZorroAntdModule, FormsModule, HttpClientModule, BrowserAnimationsModule, // 这里 ReactiveFormsModule ], providers: [{ provide: NZ_I18N, useValue: zh_CN }], bootstrap: [AppComponent] }) export class AppModule { }
- 在对应的module文件中 引入
网友评论