Zyg*_*tas 4 tsconfig angular-cli angular
是否有任何配置设置可以删除这些空注释和空格?
我的构建命令ng build --environment prod --progress false --target production和 tsconfig 是:
{
"compileOnSave": false,
"compilerOptions": {
"alwaysStrict": true,
"baseUrl": "/",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"lib": [ "es2015", "dom" ],
"module": "es2015",
"moduleResolution": "node",
"newLine": "CRLF",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "./dist/out-tsc",
"removeComments": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"strictNullChecks": true,
"target": "es5",
"typeRoots": [ "./node_modules/@types" ]
}
}
Run Code Online (Sandbox Code Playgroud)
@angular/cli:1.0.4
节点:7.2.1
操作系统:win32 x64
@angular/common:4.1.3
谢谢你。
这是根据您的 Angular 指令、标签、条件(if,for...)生成的,因此需要此空格。如果你删除它,那么它不会表现得很好,所有两种方式的绑定都会消失。这些空间决定了你的Angular DOM将如何呈现和绑定到模型和变量。注释还跟踪新 DOM 元素将呈现的位置(如果条件和其他)。
有关更多信息,请参阅此链接:https : //github.com/angular/angular.js/issues/8722
这些注释中的每一个都是ViewContainerRefAngular 用来为可以渲染视图的表达式保留位置的。
当你有一个时ngIf,如果表达式被评估为 false,显然 Angular 不会渲染该元素,但是一旦它变为 true,它就会渲染该元素,那么它如何知道将其放在哪里呢?
<div *ngIf="expression"></div>
Run Code Online (Sandbox Code Playgroud)
当然还有其他表达式求值和视图模板绑定,但这ngIf是最容易理解的
这就是这些评论的来源。
| 归档时间: |
|
| 查看次数: |
1460 次 |
| 最近记录: |