我有一个父组件 AdsbyuserComponent,我需要使用 ag-grid 编辑或添加一行。我已经设法将信息发送到服务器,但是在关闭弹出表单时,我无法刷新表格。这是我的代码
AdsbyuserComponent
update(ad :Ad) {
let ngbModalOptions: NgbModalOptions = {
backdrop : 'static',
keyboard : false ,
};
const modalRef = this.modalService.open(EditAdComponent,ngbModalOptions);
modalRef.componentInstance.ad = ad;
}
编辑广告组件
onFormSubmitEdit() {
this.activeModal.close();
this.submitted = true;
if (this.adForm.invalid) {
return;
}
const ad = this.adForm.value;
this.authService.getCurrentUser().subscribe((result) => {
if (result) {
ad.idowner = result.idUser;
this.adService.updateAd(ad).subscribe(
(res) => {
},
(err) => {
console.log(err);
alert(err.error);
}
);
}
});
}