在旧的angular cli中有一个名为defaults
的键
"defaults": {
"schematics": {
"collection": "@nrwl/schematics",
"postGenerate": "npm run format",
"newProject": [
"app",
"lib"
]
},
"styleExt": "scss",
"component": {
"changeDetection": "OnPush"
}
}
此属性不再存在。如何在angular cli 6+中添加推送的component/changeDetection?此外,是否有我可以添加的零部件特性列表?
发布于 2018-06-02 15:07:10
我不太熟悉旧的CLI。这些属性是配置为全局CLI设置还是每个项目的设置?
在新的Angular CLI中,您可以通过将schematics
对象更新为以下内容来复制angular.json
文件中的每个项目的设置:
"projects": { "my-project": { "root": "", "sourceRoot": "src", "projectType": "application", "prefix": "app", "schematics": { "@schematics/angular:component": { "changeDetection": "OnPush" } },
发布于 2019-08-15 02:53:34
通过Angular CLI,您可以执行以下操作:
ng config schematics.@schematics/angular:component.changeDetection OnPush
发布于 2018-06-02 09:09:03
可以在angular.json的schematics部分中查看schematics:https://github.com/angular/angular-cli/wiki/angular-workspace我不确定您是否可以直接编辑component的默认schematics,或者您必须创建自己的使用component schematic的原理图,如本教程:https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2 (部分:调用另一个原理图)所示。
https://stackoverflow.com/questions/50651977
复制相似问题