国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

AngularJS表達式講解及示例代碼

2019-11-20 09:13:38
字體:
來源:轉載
供稿:網友

表達式用于應用程序數據綁定到HTML。表達式都寫在雙括號就像{{表達式}}。表達式中的行為跟ng-bind指令方式相同。 AngularJS應用表達式是純javascript表達式,并輸出它們被使用的數據在那里。

使用數字

<p>Expense on Books : {{cost * quantity}} Rs</p>

使用字符串

<p>Hello {{student.firstname + " " + student.lastname}}!</p>

使用對象

<p>Roll No: {{student.rollno}}</p>

使用數組

<p>Marks(Math): {{marks[3]}}</p>

例子

下面的例子將展示上述所有表達式。

testAngularJS.html 文件代碼如下:

<html><title>AngularJS Expressions</title><body><h1>Sample Application</h1><div ng-app="" ng-init="quantity=1;cost=30; student={firstname:'Mahesh',lastname:'Parashar',rollno:101};marks=[80,90,75,73,60]">  <p>Hello {{student.firstname + " " + student.lastname}}!</p>    <p>Expense on Books : {{cost * quantity}} Rs</p>  <p>Roll No: {{student.rollno}}</p>  <p>Marks(Math): {{marks[3]}}</p></div><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script></body></html>

輸出

在Web瀏覽器打開textAngularJS.html。看到結果如下:

以上就是對AngularJS 表達式的資料整理,后續繼續補充相關資料,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 正阳县| 寻甸| 阿合奇县| 宣威市| 嘉峪关市| 华坪县| 夏河县| 常德市| 阿合奇县| 保靖县| 安新县| 莱州市| 宝坻区| 乐至县| 鄄城县| 自贡市| 滦平县| 望谟县| 永康市| 田东县| 玛曲县| 花莲市| 临西县| 屏东市| 满城县| 千阳县| 沙坪坝区| 辽宁省| 沙坪坝区| 华安县| 无锡市| 柘荣县| 吉安县| 周宁县| 中宁县| 井冈山市| 丁青县| 宁武县| 临澧县| 长岛县| 库伦旗|