How do I disable template binding in for part of template in Angular2?

前端 未结 2 387
不知归路
不知归路 2020-12-02 00:41

I would like to display {{ name }} string in Angular 2 template.

How do I disable template binding for part of template?

相关标签:
2条回答
  • 2020-12-02 01:27

    Update for Angular 4/5. Now, for printing { symbol inside angular template:

     {{ '{' }}

    ng serve out Error showing up the correct way

    My package.json:

    
            {
          "name": "angular-client",
          "version": "0.0.0",
          "description": "My Angular Client",
          "author": "noone",
          "copyright": "",
          "license": "UNLICENSED",
          "scripts": {
            "ng": "ng",
            "start": "ng serve",
            "build": "ng build",
            "test": "ng test",
            "lint": "ng lint",
            "e2e": "ng e2e"
          },
          "private": true,
          "dependencies": {
            "@angular/common": "^4.4.6",
            "@angular/compiler": "^4.4.6",
            "@angular/core": "^4.4.6",
            "@angular/forms": "^4.4.6",
            "@angular/http": "^4.4.6",
            "@angular/platform-browser": "^4.4.6",
            "@angular/platform-browser-dynamic": "^4.4.6",
            "@angular/router": "^4.4.6",
            "@angular/upgrade": "^4.4.6",
            "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
            "chart.js": "^2.5.0",
            "core-js": "^2.4.1",
            "file-saver": "^1.3.3",
            "lodash": "^4.17.4",
            "moment": "^2.18.1",
            "ng2-charts": "^1.5.0",
            "ng2-currency-mask": "^4.3.1",
            "ng2-slim-loading-bar": "^4.0.0",
            "ngx-bootstrap": "^1.9.3",
            "rxjs": "^5.3.0",
            "stacktrace-js": "^2.0.0",
            "ts-helpers": "^1.1.2",
            "zone.js": "^0.8.8"
          },
          "devDependencies": {
            "@angular/cli": "^1.0.2",
            "@angular/compiler-cli": "^4.4.6",
            "@types/jasmine": "^2.5.47",
            "@types/node": "^7.0.13",
            "codelyzer": "^2.1.1",
            "jasmine-core": "^2.5.2",
            "jasmine-spec-reporter": "^3.2.0",
            "karma": "^1.6.0",
            "karma-chrome-launcher": "^2.0.0",
            "karma-cli": "^1.0.1",
            "karma-coverage-istanbul-reporter": "^1.2.0",
            "karma-jasmine": "^1.1.0",
            "karma-jasmine-html-reporter": "^0.2.2",
    
            "protractor": "^5.1.1",
    
    
            "ts-node": "^3.0.2",
            "tslint": "^4.5.1",
            "typescript": "^2.2.2"
          }
        }
    
    
    0 讨论(0)
  • 2020-12-02 01:38

    Add the ngNonBindable attribute to the tag, then Angular doesn't process bindings.

    Plunker example

    0 讨论(0)
提交回复
热议问题