{{}}-双大括号:
{{}} 是Angular表达式,当您希望将内容编写为HTML时非常方便:<div> {{planet.name == "Earth" ? "Yeah! We 're home!" : "Eh! Where 're we?"}}</div><!-- with some directives like `ngSrc` --><img ng-src="http://www.example.com/gallery/{{hash}}"/><!-- set the title attribute --><div ng-attr-title="{{celebrity.name}}">...<!-- set a custom attribute for your custom directive --><div custom-directive custom-attr="{{pizza.size}}"></div>不要在已经是表达式的地方使用它们!
例如,该指令
ngClick将引号之间的任何内容都视为一个表达式:
<!-- so dont do this! --><!-- <button ng-click="activate({{item}})">... -->{}-大括号:
{}我们知道Javascript代表对象。这里也没有什么不同:<div ng-init="distanceWalked = {mon:2, tue:2.5, wed:0.8, thu:3, fri:1.5, sat:2, sun:3}">使用一些类似
ngClass或
ngStyle接受map的指令:
<span ng->{{viruses.length}} viruses found!</span><div ng->..没有花括号:
如前所述,在表达式内部时要毫不留情。非常简单:
<div ng-if="zoo.enclosure.inmatesCount == 0"> Alarm! All the monkeys have escaped!</div>



