Angularjs UI.引导分页自定义模板



嗨,我想告诉我们,如果你能给我一个Angularjs UI引导分页的正确示例代码来定制模板吗?

我试着在谷歌和stackoverflow中搜索,但我找不到任何关于如何使用模板url为该功能组件分页的正确示例或解释。

https://angular-ui.github.io/bootstrap/#/pagination

我想将缓存模板"template/pagination/pagination.html"更改为类似的内容

<script type="text/ng-template" id="custompagination.html">
code here...
</script>

但它给了我一个错误。如果你有我可以在线阅读的样本或提示,请告诉我。

谢谢,

您应该能够在HTML中定义自定义模板,如下所示:

<script type="text/ng-template" id="template/pagination/pagination.html">
  <div class="pager">
    <div class="page" ng-click="selectPage(page.number)" ng-repeat="page in pages" ng-class="{active: page.active, disabled: page.disabled}">{{page.text}}</div>
  </div>
</script>

以及一些CSS样式(如果需要):

div.page {
  float:left;
  background-color: #cccccc;
  width:20px;
  height:20px;
}
div.active {
  font-weight: bold;
  background-color: #ffffff;
}

您可以使用script指令覆盖模板。因为这与默认的引导分页模板有相同的ID,所以它会覆盖它。

最新更新