开发手册 欢迎您!
软件开发者资料库

AngularJS - 表达式

AngularJS表达式 - 从简单和简单的步骤学习AngularJS,从基本到高级概念,包括概述,环境设置,MVC架构,第一个应用程序,指令,表达式,控制器,过滤器,表,HTML DOM,模块,表单,包含,Ajax ,视图,范围,服务,依赖注入,自定义指令,内部化,ToDo应用程序,记事本应用程序,Bootstrap应用程序,登录应用程序,上载文件,在线应用程序,导航菜单,切换菜单,订单表格,搜索选项卡,拖动应用程序,购物车申请,翻译申请,图表申请,地图申请,分享申请,天气申请,计时器申请,传单申请,Lastfm申请。

表达式用于将应用程序数据绑定到HTML.表达式写在双花括号内,例如{{expression}}.表达式的行为类似于ngbind指令. AngularJS表达式是纯JavaScript表达式,并输出使用它们的数据.

使用数字

Expense on Books : {{cost * quantity}} Rs

使用字符串

Hello {{student.firstname + " " + student.lastname}}!

使用对象

Roll No: {{student.rollno}}

使用数组

Marks(Math): {{marks[3]}}

示例

以下示例显示了使用上述所有表达式 :

testAngularJS.htm

         AngularJS Expressions               

Sample Application

                     

Hello {{student.firstname + " " + student.lastname}}!

         

Expense on Books : {{cost * quantity}} Rs

         

Roll No: {{student.rollno}}

         

Marks(Math): {{marks[3]}}

      
                           

输出

在网络浏览器中打开文件 testAngularJS.htm 并查看结果.