Hello

I have attached code in VS code which helps to generate dummy data. the
basic purpose of having pagination in anguar 6 project.

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)
}
);
}

 In above code error I slated error, the full code is at below:

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;
}
}

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to