To bind the value in $scope in ng-bind, you need to write {{}}
To bind the value in $scope in ng-src, you need to write {{}}
You don’t need to write {{}}
to determine true or false in ng-checked. In ng-class, you need to write {}
When do you need {{}} and when do you need {}? Are there any rules for this?
迷茫2017-05-15 17:04:58
You remember one thing, as long as it is ng-
开关的指令,大都是不需要写的。ng-src
except.
ng-src
为什么要呢?主要是因为不能直接用 src
,它会直接请求,不等待 Angular 解析 {{}}
,而 ng-src
Mainly to achieve effects similar to this:
<img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
So, that’s it.
ng-class
实际上是需要你提供一个对象,所以使用 {}
to construct.