AngularJS集合數(shù)據(jù)遍歷顯示的實例
更新時間:2017年12月27日 08:44:54 作者:你我他學(xué)習(xí)吧
下面小編就為大家分享一篇AngularJS集合數(shù)據(jù)遍歷顯示的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AngularJS集合數(shù)據(jù)遍歷顯示</title>
<script type="text/javascript" src="../js/angular.min.js"></script>
</head>
<body ng-app="myapp" ng-controller="myctrl">
<table width="100%" border="1">
<tr>
<td>序號</td>
<td>商品編號</td>
<td>商品名稱</td>
<td>價格</td>
</tr>
<tr ng-repeat="product in products">
<td>{{$index+1}}</td>
<td>{{product.id}}</td>
<td>{{product.name}}</td>
<td>{{product.price}}</td>
</tr>
</table>
</body>
<script type="text/javascript">
var myapp = angular.module("myapp",[]);
myapp.controller("myctrl",["$scope",function($scope){
$scope.products = [
{
id:1001,
name:'數(shù)碼相機',
price:5000
},
{
id:1002,
name:'華為手機',
price:4000
}
];
}])
</script>
</html>
相關(guān)文章
Angular使用ng-messages與PHP進行表單數(shù)據(jù)驗證
這篇文章主要介紹了Angular使用ng-messages與PHP進行表單數(shù)據(jù)驗證,ng-messages提供了更方便的表單數(shù)據(jù)驗證服務(wù),具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-12-12
詳解Angular 4.x 動態(tài)創(chuàng)建組件
本篇文章主要介紹了詳解Angular 4.x 動態(tài)創(chuàng)建組件,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-04-04
angularjs $http實現(xiàn)form表單提交示例
這篇文章主要介紹了angularjs $http實現(xiàn)form表單提交示例,非常具有實用價值,需要的朋友可以參考下2017-06-06
AngularJS基礎(chǔ) ng-repeat 指令簡單示例
本文主要講解AngularJS ng-repeat 指令,這里對ng-repeat的基礎(chǔ)資料做了整理,并附有示例代碼,有興趣的朋友可以參考下2016-08-08
Angular5中調(diào)用第三方j(luò)s插件的方法
下面小編就為大家分享一篇Angular5中調(diào)用第三方j(luò)s插件的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-02-02
angular中實現(xiàn)li或者某個元素點擊變色的兩種方法
本篇文章主要介紹了angular中實現(xiàn)li或者某個元素點擊變色的兩種方法,非常具有實用價值,需要的朋友可以參考下2017-07-07

