【问题标题】:html - Select default tab inside pagination for list itemhtml - 为列表项选择分页内的默认选项卡
【发布时间】:2015-12-28 20:31:05
【问题描述】:
<div>
    <pagination ng-show="ready"
                total-items="total"
                ng-model="index"
                ng-change="func()"
                class="pagination-sm"
                boundary-links="true"
                items-per-page="1"
                max-size="15">
    </pagination>
    <ul class = "active">
        <li><a>val1</a></li>
        <li><a>val2</a></li>
        <li ng-repeat="o in values"> <a>{{o.val}}</a></li>
    </ul>
</div>

每个分页中都会显示一组选项卡。在第 1 页上选择了默认选项卡 (val1)。假设我将选项卡更改为 val2 或来自 ng-repeat 的其他内容。我转到第 2 页(目前没有选择任何内容)。我怎样才能使val1被选中?

谢谢...

【问题讨论】:

    标签: javascript html angularjs html-lists jquery-pagination


    【解决方案1】:

    请尝试以下方法:

    <ul>
        <li ng-repeat="o in values" heading="{{o.title}}" active="o.active">      
            <a>{{o.val}}</a>
        </li>
    </ul>
    <script type="text/javascript">
        $scope.active = function() {
            return $scope.o.filter(function(o){
              return o.active;
            })[0];
        };
    </script>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多