好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

angular 5的新特性

angular有一个新的选项,preserveWhitespaces,从模板代码中删除非重要的空白字符,让应用程序的最终大小进一步压缩。这个选项默认是关闭的。需要把它添加到全局的tsconfig.json文件。

 {
   "compileOnSave":  false  ,
   "compilerOptions" : {
     "outDir": "./dist/out-tsc" ,
     "sourceMap":  true  ,
     "declaration":  false  ,
     "moduleResolution": "node" ,
     "emitDecoratorMetadata":  true  ,
     "experimentalDecorators":  true  ,
     "target": "es5" ,
     "typeRoots": ["node_modules/@types" ],
     "lib": ["es2017", "dom" ]
  },
   "angularCompilerOptions" : {
     "preserveWhitespaces":  false  
  }
} 

这个选项也可以在某个组件上使用,在组件的@component中添加preseveWhitespaces:false。

待续...

查看更多关于angular 5的新特性的详细内容...

  阅读:36次