1、问题背景
AngularJS中有有序列表,也有无序列表;现在利用AngularJS制作有序列表
2、实现源码
<!DOCTYPE html> <html> <head> <Meta charset="UTF-8"> <title>AngularJS之有序列表</title> <script type="text/javascript" src="../js/angular.min.js" ></script> <script> var app = angular.module("olApp",[]); app.controller("olCon",function($scope){ $scope.person = [ {name:"张华"},{name:"李四"},{name:"赵武"},{name:"孙继"},{name:"胡杰"} ]; }); </script> </head> <body> <div ng-app="olApp"> <ol ng-controller="olCon"> <li ng-repeat="p in person"> {{p.name}} </li> </ol> </div> </body> </html>
3、问题说明
利用AngularJS中的ng-app、ng-controller和ng-repeat指令来实现有序列表