Organizational Research By

Surprising Reserch Topic

angularjs why ng bind is better than in angular

angularjs why ng bind is better than in angular  using -'javascript,angularjs,ng-bind'

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

One of the reason, 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 in on the screen you can use {{}} and the performance issue will not be visible. Can someone shed some light on this issue for me?

asked Oct 11, 2015 by android_master
0 votes
1 view

Related Hot Questions

5 Answers

0 votes

If you are not using ng-bind, instead something like this:

Hello, {{}}

you might see the actual Hello, {{}} for a second before is resolved (before the data is loaded)

You could do something like this


if that's an issue for you.

Another solution is to use ng-cloak.

answered Oct 11, 2015 by badhwar.rohit
0 votes


While your angularjs is bootstrapping, the user might see your placed brackets in the html. This can be handled with ng-cloak. But for me this is a workaround, that i don't need to use, if i use ng-bind.


The {{}} is much slower.

This ng-bind is a directive and will place a watcher on the passed variable. So the ng-bind will only apply, when the passed value does actually change.

The brackets on the other hand will be dirty checked and refreshed in every $digest, even if it's not necessary.

I am currently building a big single page app (~500 bindings per view). Changing from {{}} to strict ng-bind did save us like 20% in every scope.$digest.


If you use a translation module like angular-translate always prefer directives before brackets annotation.

{{'WELCOME'|translate}} =>

If you need an filter function, better go for a directive, that actually just uses your custom filter. Documentation for $filter service

UPDATE 28.11.2014 (but maybe off the topic):

In Angular 1.3x the "bindonce" functionality got introduced. Therefore you can bind the value of an expression/attribute once (will be bound when != 'undefined').

This is useful, when you dont expect your binding to change.

Usage: Place "::" before your binding:

  • {{item}}


ng-repeat to output some data in the table, with multiple bindings per row. Translation-bindings, filter outputs, which get executed in every scope digest.

answered Oct 11, 2015 by tushar2k6
0 votes

ng-bind is better than {{}} .

like this :

Hello, {{variable}}

This means that the whole text "Hello, {{variable}}" enclosed by < div > will be copied and stored in memory .

If you do something like this :


That will only stored the value of variable in memory , angular will register a watcher where the watch expression consists of the variable only.

answered Oct 11, 2015 by santosh soni
0 votes

Basically the double-curly syntax is more naturally readable and requires less typing.

Both cases produce the same output but.. if you choose to go with the double-curly there is a chance that the user will see for some milisecs the {{}} before your template rendered by angular. So if you notice any {{}} then is better to use ng-bind.

Also very important is that only in your index.html of your angular app you can have un-rendered {{}}. If you are using directives so then templates, there is no chance to see that because angular first render the template and after append it to the DOM.

answered Oct 11, 2015 by vijaygupta1980
0 votes

This is because with {{}} angular compiler considers both the text node and it's parent as there is a possibility of merging of 2 {{}} nodes. Hence there are additional linkers that add to the load time. Of course for a few such occurrences the difference is immaterial, however when you are using this inside a repeater of large number of items, it will cause an impact in slower runtime environment.

answered Oct 11, 2015 by shikhar jain