我的API数据位于默认的HTML表中。我想用角度材料dataTable更改此表。
我尝试更改该表,但无法修复。我不明白该如何解决。如果有人使用过此表或对此有所了解。帮助我或提出任何有关更改方法的想法。
我想在组件https://stackblitz.com/angular/mnbkjxbrpaj?file=app%2Ftable-overview-example.ts中使用此表
.ts文件代码在这里
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-list-fit',
templateUrl: './list-fit.component.html',
styleUrls: ['./list-fit.component.scss']
})
export class ListFitComponent implements OnInit {
userToken: string;
fitData: Array<any> = [];
constructor(private https: HttpClient) {
this.userToken = localStorage.getItem('credentials');
}
ngOnInit() {
this.getFitType();
}
getFitType() {
const data = {
user: this.userToken
};
this.https.post<any>('api/fit/list', data).subscribe(
response => {
if (response.response_code === 200) {
this.fitData = response.fit;
}
},
error => {
console.log(error.error);
}
);
}
}