Thanks Martin for your great article. I have been able to build my first CRUD in Angular. But now I'm stuck with the problem of including pagination with angular material. In the component we can get the observables (this.cargosPosts $ = this.cargoPostService.getCargoPosts ();) But how can I assign the data source to the pager?
---- In the component
this.cargosPosts$ = this.cargoPostService.getCargoPosts();
this.lstCargos = this.cargoPostService.lstCargos;
this.dataSource = new MatTableDataSource(this.lstCargos);
I'm very greatful if you can help me. Thankou very much
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks Martin for your great article. I have been able to build my first CRUD in Angular. But now I'm stuck with the problem of including pagination with angular material. In the component we can get the observables (this.cargosPosts $ = this.cargoPostService.getCargoPosts ();) But how can I assign the data source to the pager?
I tried this, but don't run...
--- In the service
public lstCargos: Array = [];
getCargoPosts(): Observable {
this.http.get(this.myAppUrl + this.myApiUrlList).subscribe(result =>
{
this.lstCargos = result;
console.log(this.lstCargos)
}, error => console.error(error));
}
---- In the component
this.cargosPosts$ = this.cargoPostService.getCargoPosts();
this.lstCargos = this.cargoPostService.lstCargos;
this.dataSource = new MatTableDataSource(this.lstCargos);
I'm very greatful if you can help me. Thankou very much