AngularJS 表达式与ng-bind

初学 多看语法的具体表现  有助于理解 与实际应用

AngularJS 表达式

AngularJS 表达式写在双大括号内:{{ expression }}。

AngularJS 表达式把数据绑定到 HTML,这与 ng-bind 指令有异曲同工之妙。

AngularJS 将在表达式书写的位置"输出"数据。

AngularJS 表达式 很像 JavaScript 表达式:它们可以包含文字、运算符和变量。

实例 {{ 5 + 5 }} 或 {{ firstName + " " + lastName }}

1.数字

总价: {{ quantity * cost }}

2.字符串 

{{ firstName + " " + lastName }}

3.对象

{{ person.lastName }}

4.数组

{{ points[2] }}

------ng-bind-----相同的实现-----------------

ng-bind="quantity * cost"

ng-bind="firstName + ' ' + lastName"

ng-bind="person.lastName"

ng-bind="points[2]

posted @ 2016-05-08 23:28  pino宋  阅读(4022)  评论(0编辑  收藏  举报