Angular application without annotations
P粉939473759
P粉939473759 2023-11-10 10:51:51
0
2
649

Is there any configuration setting to remove these empty comments and spaces?

My build command is ng build --environment prod --progress false --target production and tsconfig is:

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

@angular/cli:1.0.4

Node: 7.2.1

Operating system: win32 x64

@angle/common:4.1.3

Thanks.

P粉939473759
P粉939473759

reply all(2)
P粉978551081

Each of these annotations is a ViewContainerRef that Angular uses to hold the position of an expression that can render the view.

When you have a ngIf, if the expression evaluates to false, obviously Angular will not render the element, but once it becomes true, it will render the element, so how Any idea where to put it?

Of course there are other expression evaluations and view template bindings, but ngIf is the easiest to understand

This is where these comments come from.

P粉994092873

This is generated based on your Angular directives, tags, conditions (if, for...), so this space is required. If you remove it then it won't perform very well and all two way bindings will disappear. These spaces determine how your angular DOM will be rendered and bound to models and variables. Additionally, the annotation tracks where the new DOM element will be rendered (if conditional and otherwise).

See this link for more information: https://github.com/angular/angular.js/issues/8722

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template