Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't evaluate variable in view

Tags:

angularjs

I have a site built with AngularJS. I need to put a text somewhere on the page that looks something like this: Use {{name}} to display the username.

But AngularJS automatically tries to evaluate {{name}}. But in this case I don't want it to be evaluated. I just simply want to show that as a text.

I already tried to use the unicode characters: {{name}}. But it still evaluates that...

Is there a way to do this?

like image 803
Vivendi Avatar asked Aug 23 '14 21:08

Vivendi


1 Answers

Use the ngNonBindable directive

<span ng-non-bindable>Use {{name}} to display the username.</span>
like image 199
JB Nizet Avatar answered Nov 06 '22 09:11

JB Nizet