This article mainly introduces the method of AngularJS traversal to obtain array elements, involving AngularJS simple array traversal and element acquisition related operation skills. Friends in need can refer to it, I hope it can help everyone.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>获取数组的元素例子</title> <script src="angular.min.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>
Run results:
Related recommendations:
Analysis of the path method of converting php array to string to obtain array representation
Detailed explanation of AngularJS using ng-repeat to traverse two-dimensional array elements
Several methods of php traversing two-dimensional arrays
The above is the detailed content of Detailed example of AngularJS traversal to obtain array elements. For more information, please follow other related articles on the PHP Chinese website!