Search code examples
angularangular2-templatestring-interpolation

How to disable interpolated string angular 2+


I have following code line in my angular 7 template

<span>{{process.env.CLIENT_ID}}</span>

I want to disable interpolation on {{process.env.CLIENT_ID}} expiration so that it should render following text in browser.

{{process.env.CLIENT_ID}}

Is it possible to achieve this with out storing it into a variable as a string?


Solution

  • Use ngNonBindable when we want tell Angular not to compile, or bind, a particular section of page.

    <div ngNonBindable>
      {{process.env.CLIENT_ID}}
    </div>
    

    PS: I am not sure if this is official way as there is no documentation for it on the angular docs.