<!DOCTYPE html> <html ng-app='app' ng-controller='mainController'> <head> <meta charset="utf-8"> <title></title> <script src="angular.js"></script> </head> <body> <ul> <li ng-repeat='pname in names'>{{pname}}</li> </ul> <div ng-repeat='info in bookInfos trank by $index'> <p>书名:{{info.bookName}}</p> <p>作者:{{info.author}}</p> </div> <script> //页面数据模型 var app = angular.module('app',[]); //实现html标签的控制器 app.controller('mainController',['$scope',function($scope){ $.scope.names = ['666','55','333','22']; $.scope.bookInfos = [ {bookName:'js入门',author:'frank'}, {bookName:'js精通',author:'frank'}, ]; }]); /* ng-repeat:重复创建标签遍历指令 <li ng-repeat='pname in names track by $index'>{{panme}}</li> track by $index---不介意有重复元素 */ </script> </body> </html>