viewEncapsulation is not defined

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u012955029/article/details/78363316

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"
}

猜你喜欢

转载自blog.csdn.net/u012955029/article/details/78363316