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

ng-repeat-start與ng-repeat-end時AngularJS(1.2.x)擴展的,html

使用這兩個指令能夠靈活控制遍歷形式。spa

例如:code

index.htmlhtm

<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.jsblog

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'
            }
        ];
        
        
}]);

 

運行結果:ip

相關文章
相關標籤/搜索