i'm working in a simple application with angular5 , i have a page which returns the lists of some projects information using an API Restful with spring boot .
everything goes well , but i can't get that working while trying to use Pagination following a tutorial in youtube .
this is the method where i get an error
pageProjects:any;
pages:Array<number>;
ngOnInit() {
this.projetSevice.getProjects(this.currentPage,this.size)
.subscribe(data=>{
this.pageProjects=data;
this.pages=new Array(data.totalPages);
},err=>{
console.log('this is error');
})
}
i get this error :
TS2339 : Property totalPages doesnt exist on type Object
how can i resolve this ? thank you in advance .
This is because Typescript compiler checks that data variable. To fix this explicitly tell TypeScript type of data as any ,
this.projetSevice.getProjects(this.currentPage,this.size)
.subscribe((data:any)=>{