ng-repeat-start ng-repeat-end 的使用

ng-repeat-start与ng-repeat-end时AngularJS(1.2.x)扩展的,

使用这两个指令可以灵活控制遍历形式。

例如:

index.html

<div class="uk-panel" ng-controller="UserCtrl">
            <ul class="uk-list uk-list-striped">
                <li ng-repeat-start="user in users">
                    {{user.name}}
                </li>
                <li ng-repeat-end>
                    {{user.email}}
                </li>
            </ul>
        </div>

index.js

var myApp = angular.module('myApp', []);

myApp.controller('UserCtrl', ['$scope', function($scope){
        $scope.users = [
            {
                name:'张三',
                email:'zhangsan@gmail.com'
            },
            {
                name:'李四',
                email:'lisi@123.com'
            },
            {
                name:'王五',
                email:'wangwu@qq.com'
            }
        ];
        
        
}]);

 

运行结果:

posted @ 2015-02-04 19:01  yshy  阅读(12094)  评论(1编辑  收藏  举报