我有一个表格,将显示数据。对于&request,一切正常,但只有在刷新页面时,我才能在插入后看到值。POSTGET
abc.service.ts
createExamCategory(options) {
return this.http.post<{ message: string }>(this.url + '/createExamCategory', options);
}
getExamCategory():Observable<any> {
return this.http.get<any>(this.url + '/getAllExamCategory');
}
abc.component.ts
onSubmit() {
if(this.formdata.invalid) {
return;
}
this.adminCategory.createExamCategory(this.formdata.value).subscribe(reponse => {
console.log(reponse.message);
});
}
ngOnInit() {
this.columnsToDisplay = ['id', 'examCategoryName', 'isActive', 'Action'];
this.adminCategory.getExamCategory().subscribe((reponse: any) => {
this.ExamCategoryData = reponse.examCategoryList;
this.dataSource = new MatTableDataSource(this.ExamCategoryData);
this.dataSource.paginator = this.paginator;
}, error => {
console.log(error);
}
);
}
这是我的代码。我需要进行哪些必要的更改?
哔哔one
慕少森
Helenr
相关分类