html - 如何使用angular2在分页中用左右箭头替换上一个和下一个

标签 html css angular pagination

我有一个分页,我得到上一个和下一个。谁能帮我用左右箭头替换它

HTML:

<pagination-controls (pageChange)="page = $event" id="1" maxSize="10" directionLinks="true" autoHide="true" class="page">
      </pagination-controls>

CSS:

.left {
  display: inline-block;
  width: 4em;
  height: 4em;
  margin-right: 1.5em;
}

.left:after {
  content: '';
    display: inline-block;
  margin-top: 1.05em;
  margin-left: 0.6em;
  width: 1.4em;
  height: 1.4em;
  border-top: 0.5em solid #333;
  border-right: 0.5em solid #333;
  -moz-transform: rotate(-135deg);
  -webkit-transform: rotate(-135deg);
  transform: rotate(-135deg);
}

.right {
  display: inline-block;
  width: 4em;
  height: 4em;
  margin-left: 1.5em;
}

.right:after {
  content: '';
    display: inline-block;
  margin-top: 1.05em;
  margin-left: -0.6em;
  width: 1.4em;
  height: 1.4em;
  border-top: 0.5em solid #333;
  border-right: 0.5em solid #333;
  -moz-transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}

这是左右箭头的 css,我怎么用 html 写这个,我的意思是如何链接?

最佳答案

您使用的分页插件是完全可定制的

您甚至可以创建完全自定义的模板。

这是我创建的示例,

组件,

export class AppComponent {
  collection = [];
  constructor() {
    for (let i = 1; i <= 100; i++) {
      this.collection.push(`item ${i}`);
    }
  }
   public config: PaginationInstance = {
        id: 'custom',
        itemsPerPage: 10,
        currentPage: 1,
        directionLinks: false
    };
}

自定义 HTML,

<div class="container-fluid">
  <div class="row">
    <div class="medium-8 medium-offset-2 columns">
        <h2 class="subheader"></h2>
        <ul>
          <li *ngFor="let item of collection | paginate: config">{{ item }}</li>
        </ul>
    </div>
  </div>
  <div class="row">
    <pagination-template #p="paginationApi"
    [id]="config.id"
    (pageChange)="config.currentPage = $event">
    <div class="custom-pagination">
        <div class="pagination-previous" [class.disabled]="p.isFirstPage()">
          <a *ngIf="!p.isFirstPage()" (click)="p.previous()"> < </a>
        </div>
        <div *ngFor="let page of p.pages" [class.current]="p.getCurrent() === page.value">
          <a (click)="p.setCurrent(page.value)" *ngIf="p.getCurrent() !== page.value">
          <span>{{ page.label }}</span>
          </a>
          <div *ngIf="p.getCurrent() === page.value">
            <span>{{ page.label }}</span>
          </div>
        </div>
      <div class="pagination-next" [class.disabled]="p.isLastPage()">
          <a *ngIf="!p.isLastPage()" (click)="p.next()"> > </a>
      </div>
    </div>
    </pagination-template>
  </div>
</div>

Here is their official custom template document

A WORKING DEMO

附言:

您甚至可以添加您的 css 代码并根据需要对其进行自定义

关于html - 如何使用angular2在分页中用左右箭头替换上一个和下一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47179091/

相关文章:

Angular2 - 具有登录和记住用户功能的应用程序

javascript - 输入值与数字的严格相等比较返回 false

javascript - 使用javascript将数据写入本地文本文件

javascript - Uncaught ReferenceError : require is not defined on Angular 2 webpack global library installation

javascript - jquery UI datepicker透明背景

javascript - Angular-ui-bootstrap Accordion 和折叠动画不起作用

angular - 如何针对本质上动态的 JSON 创建 Angular FORM?

php - 我如何使用 cookie 来存储购物车内容?

html - HTML 表格中的列宽

html - 没有主div的左侧和右侧的div