Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in Web Technology by (47.6k points)

I was in one of the angular presentations and one of the people in the meeting mentioned ng-bind is better than {{}} binding.

One of the reasons, ng-bind put the variable in the watch list and only when there is a model change the data get pushed to view, on the other hand, {{}} will interpolate the expression every time (I guess it is the angular cycle) and push the value, even if the value changed or not.

Also, it is said that, if you have not much data on the screen you can use {{}} and the performance issue will not be visible. Can someone shed some light on this issue for me?

1 Answer

+2 votes
by (106k points)
edited by

You can use the below-mentioned code if you are not using ng-bind:-

<div> Hello, {{user.name}} </div>

You can also do like as follows:-

<div> Hello, <span ng-bind="user.name"></span> </div>

Another method you can use is ng-cloak.

Want to become an Angular expert? Join this Angular Online Training now!

Related questions

0 votes
1 answer
0 votes
1 answer
+2 votes
2 answers
+2 votes
1 answer
0 votes
1 answer

Browse Categories

...