AngularJs獲取陣列的元素例子
阿新 • • 發佈:2019-02-15
身為菜鳥的自我修養,能學一點是一點,能發一點是一點,啦啦啦~~~
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>獲取陣列的元素例子</title>
<script src="angular.js"></script>
<script>
var app=angular.module("lesson",[]);
app.controller("oneCtrl",function($scope){
});
</script>
</head>
<body ng-app="lesson" ng-controller="oneCtrl" ng-init="Week=['Mon','Tue','Wen','Thu','Fri','Sat','Sun']">
<!--迴圈獲取數組裡的元素start-->
獲取陣列所有元素:
<ul ng-repeat="a in Week">
<li>
<b style="color: green">{{a}}</b>
</li>
</ul>
<!--獲取陣列單個元素-->
獲取陣列單個元素:{{Week[0]}}
<!--end-->
</body>
</html>