I am new to this angular world, i am bit confused with the use of double curly braces {{}}
and single curly braces{} or sometime no curly brace is used to include the expression like in the directives
ng-class={expression}
normal data binding like{{obj.key}}
ng-hide='mydata==="red"'
Best Answer
{{}} - double curly braces:
{{}}
are Angular expressions and come quite handy when you wish to write stuff to HTML:Don't use these at a place that is already an expression!
For instance, the directive
ngClick
treats anything written in between the quotes as an expression:{} - single curly braces:
{}
as we know stand for objects in JavaScript. Here, too, nothing different:With some directives like
ngClass
orngStyle
that accept map:no curly braces:
As already mentioned just go braceless when inside expressions. Quite simple: