angular 创建 model 的时候,报错:

>ng g ng-zorro-antd:form-normal-login login
More than one module matches. Use the skip-import option to skip importing the component into the closest module or use the module option to specify a module.

 

从错误提示中分析,是创建的时候,model 放置的位置有多个,需要手动指定出放置的位置。根据文档(https://angular.cn/cli/generate#module)中提供的参数,可以使用 -m 来解决这个问题。

使用 -m app 将要创建的组件添加到 app 模块中:

>ng g ng-zorro-antd:form-normal-login login -m app
CREATE src/app/login/login.component.html (1187 bytes)
CREATE src/app/login/login.component.spec.ts (602 bytes)
CREATE src/app/login/login.component.ts (751 bytes)
CREATE src/app/login/login.component.css (239 bytes)
UPDATE src/app/app.module.ts (1205 bytes)