<!DOCTYPE html>
<html lang="en" ng-app="start">
<head>
<meta charset="UTF-8">
<title>ngRepeat</title>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body ng-controller="StudentListController">
<ul>
<li ng-repeat="student in students">
<span>{{$index+1}}</span>
<a href="/student/view/{{student.id}}">{{student.name}}</a>
</li>
</ul>
<button ng-click="insertTom()">Insert</button>
<script type="text/javascript">
angular.module('start',[])
.controller('StudentListController',function($scope){
$scope.students=[{name:"張三",id:"1"},
{name:"李四",id:"2"},
{name:"王二",id:"3"}]
$scope.insertTom=function(){
$scope.students.splice(1,0,{name:"王二",id:"4"})
}
})
</script>
</body>
</html>
angular學習日誌07 ng-repeat
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
AngularJs
maxiaole_z
2018-08-27 19:32:44
Angular.js學習筆記
南歌子
2018-08-26 01:35:46
angular學習日誌08 ng-show ng-hide
015646
2018-08-25 21:52:24
angular學習日誌06 form表單 ng-submit
015646
2018-08-25 21:51:30
Angular Provider Factory Service
015646
2018-08-25 21:51:25
angular學習日誌04 購物車!
015646
2018-08-25 21:51:22
angular學習日誌03 Hello,World
015646
2018-08-25 21:51:22
angular學習日誌02
015646
2018-08-25 21:51:20
angular學習日誌05 顯示文本 ng-bind
015646
2018-08-25 21:51:20
java項目中使用angularjs1.X,解決微信內置h5支付授權目錄配置
gbguanbo
2018-08-25 19:09:45
angularjs毫秒轉成化日期格式(date:'yyyy-MM-dd HH:mm:ss')
Sugar_Elina
2018-08-25 18:06:43
Angularjs在同個表單裏多次調用同一個自定義指令ztree
白塔臭居居
2018-08-25 15:14:06
angularjs 在指令中通過dom修改input 的Value值同時更新model
wall路小飞
2018-08-25 03:08:13
Angularjs的My97DatePicker擴展
麦栗
2018-08-23 18:47:21
Angualrjs插值字符串$interpolate
CSDN_lihe
2018-08-22 11:48:07