关于AngularJs的ng-repeat

ng-repeat生成重复标签


<div class="tab">
    <ul>
        <li class="" ng-class="{'active':currentPage==page}" 
        ng-repeat="page in pages">
            <a ng-clock="showPage(page)">
                <span ng-bind="page.title">span>
            a>
        li>
    ul>
div>

<div>
    <div ng-class="{'active':currentPage==page}" class="tab-pane"
    ng-show="currentPage==page" ng-repeat="page in pages"
    data-ng-include="page.templateUrl">
    div>
div>


<script type="text/javascript">
var page=[
{title:'标签一',templatUrl:'/页面路径',
    controller:'控制器名称',
    deps:['/页面相关js文件的路径']
    }
]

//记录点击的是第几页
$scope.showPage=function(page){  
    $scope.currentPage=page;
};

//默认第一页
$scope.showPage(pages[0]);
script>

你可能感兴趣的:(AngularJs)