请问angular14使用zorro-antd怎么在组件里使用?

新手上路,请多包涵

请问angular14使用zorro-antd怎么在组件里使用,在app.component.html 可以使用zorro-antd组件,但自己加个无法使用

'nz-form-item' is not a known element:

  1. If 'nz-form-item' is an Angular component, then verify that it is part of this module.
  2. If 'nz-form-item' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.ngtsc(-998001)
阅读 2.7k
2 个回答

多贴点代码看看
比如导入 module 的部分

参考官方文档,该组件位于NzFormModule,要想在自己的组件使用它,需要保证当前组件所在module的上下文中已经引入了这个NzFormModule.

所以你当前要做的是:

  1. 找到当前组件所在模块(module)
  2. 在该模块中找到imports关键字,加入NzFormModule
import { NzFormModule } from 'ng-zorro-antd/form';


@NgModule({
    imports: [
        NzFormModule
    ]
})
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题