在开发项目的时候,我们有时候不需要整个框架里面的模块,所以我们需要按需引入
安装ng-zorro
npm install ng-zorro-antd@7.3.3 --save
安装指定版本,比如在angular7的脚手架搭建的项目中引入最新的ngzorro8会报错
引入对应模块的样式文件
在style.scss中导入
@import '~ng-zorro-antd/style/index.min.css';
@import '~ng-zorro-antd/pagination/style/index.min.css';
导入需要使用组件的模块
在需要使用的模块中导入
import { NzPaginationModule } from 'ng-zorro-antd/pagination';
imports: [
NzPaginationModule
]
使用
<div class="pagination" *ngIf="newsList.length > 0">
<nz-pagination [nzPageIndex]="newsConditions.PageIndex" [nzTotal]="newsConditions.TotalCount"></nz-pagination>
</div>