DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Hassam Ali
Hassam Ali

Posted on • Updated on

Disable Interpolation Angular

Alt Text
You can disable string interpolation in angular by using ngNonBindable directive. This is useful in cases where you want to show some text but do not want it to be interpolated like showing some code snippet.

<div>

In angular pair of curly braces are used for string interpolation e.g

<span ngNonBindable>My name is {{name}}</span>
</div>
Enter fullscreen mode Exit fullscreen mode
<div>{{ 1 + 1 }}</div> // <div>2</div>
<div ngNonBindable>{{ 1 + 1 }}</div> // <div>{{1 + 1}}</div>
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
konradlinkowski profile image
Konrad Linkowski

That's a cool article. I didn't know that.

🌚 Friends don't let friends browse without dark mode.

Good news! You can update to dark mode in your DEV settings.