viewEncapsulation is not defined
angular-cli 创建组件问题
ng generate component component-name (生成新组件)
当使用上述命令创建新组件时,有可能会报以下错误:
viewEncapsulation is not defined (Error in blueprint template: G:\product(当前项目)\node_modules\@angular\cli\blueprints\component\files__path____name__.component.ts)
- 解决方法
打开 .angular-cli.json ,找到”defaults”,添加如下红线内代码即可:
即:
"component": {
"viewEncapsulation": "Emulated",
"changeDetection": "Default"
}