NgNonBindable

The last directive in our list to cover is the NgNonBindable directive. NgNonBindable is used when we want Angular to ignore the special symbols in our template syntax. Why would we want to do this? Well, let's say that you and I decided to create an online Angular tutorial, and the website itself was to be coded using Angular. If we wanted to render the text {{ my_value }} to the view, Angular would try to find the my_value variable within its current scope to bind the value and then insert the text in its place. Since this is not what we'd want Angular to do, we need a way to instruct Angular, Hey, by the way, do not try and evaluate and string interpolate anything right now—just render the symbols as you would with any other normal text

Here is what this looks like for, say, a span element:

<p>
To have Angular perform one-way binding, and render the value of my_value onto the view, we use the double curly braces symbol like this: <span ngNonBindable>{{ my_value }}</span>
</p>

Note the placement of the NgNonBindable directive within the opening <span> tag. When Angular sees ngNonBindable, it will disregard the double curly braces and will not one-way bind anything. Instead, it will let the raw text be rendered to the view.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.51.27