亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

AngularJS 表達式

表達式用于將應用程序數(shù)據(jù)綁定到HTML。表達式寫在雙花括號內(nèi),例如{{expression}}中。表達式的行為類似于ngbind指令。AngularJS表達式是純JavaScript表達式,并在使用它們的地方輸出數(shù)據(jù)。

使用數(shù)字

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

使用字符串

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

使用對象

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

使用數(shù)組

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

實例

以下示例顯示了所有上述表達式的使用-

testAngularJS.htm

<html>
   <head>
      <title>AngularJS表達式</title>
   </head>
   
   <body>
      <h1>示例應用程序</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 = "https://cdn.staticfile.org/angular.js/1.3.14/angular.min.js">
      </script>
      
   </body>
</html>
測試看看?/?

輸出結(jié)果

在網(wǎng)絡瀏覽器中打開文件testAngularJS.htm并查看結(jié)果。

圖片.png