简体   繁体   中英

How to bind json data with Angular material table to create dynamic table?

I am trying to populate a mat-table with data received from backend in json format. Since there is key associated with each value, I want to use that as column header instead of using a model. I went through the official doc which has only support for static column values. Anyone has any docs or github repos dealing with this issue. I came across one question in stack overflow itself Angular Material Table Dynamic Columns without model . But I have issue with understanding what happens under the comment //GET SOMETHING FROM SERVICE . Any help would be much appreciated, thank you.

//GET SOMETHING FROM SERVICE

this.listecidenKisi = this.listeciServis.listecidenKisi;
this.listecidenVazife = this.listeciServis.listecidenVazife;

These are both service function that calls back end APIs.

So this.listecidenKisi and this.listecidenVazife are array data from back end.

Please refer following for Angular Http Client.

https://angular.io/guide/http

http://prntscr.com/pvz2f1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM