项目中有嵌套路由,首先在app.component.html中引入跟组件:
<nz-root>
<router-outlet></router-outlet>
</nz-root>
并在根 module 和子module都引入了NgZorroAntdModule
在子module调用datepicker
<nz-datepicker [(ngModel)]="_date" [nzPlaceHolder]="'Select date'"></nz-datepicker>
chrome报错:
compiler.es5.js:1690 Uncaught Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'nz-datepicker'.
{{item.name}}开始时间
是我调用有什么问题吗?
If you want to use ngModel, you have to import FormsModule in your module
import { FormsModule } from '@angular/forms';
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.
Most helpful comment
If you want to use
ngModel, you have to import FormsModule in your modulehttps://angular.cn/api/forms/FormsModule