import { Component } from '@angular/core';
@Component({
selector: 'app-pagination',
templateUrl: './pagination.component.html',
styleUrls: ['./pagination.component.css']
})
export class PaginationComponent {
config: any;
collection = { count: 60, data: [] };
constructor() {
//Create dummy data
for (var i = 0; i < this.collection.count; i++) {
// var id = i +1;
// var value = "items number " + (i + 1)
this.collection.data.push(
{
id: i + 1, // here it gives error Type 'number' is not assignable to type 'never'.ts(2322)
value: "items number " + (i + 1) // same here
}
);
}
this.config = {
itemsPerPage: 5,
currentPage: 1,
totalItems: this.collection.count
};
}
pageChanged(event: any){
this.config.currentPage = event;
}
}