我有一个父组件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;
}
EditAdComponent
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);
}
);
}
});
}
答案 0 :(得分:0)
如果要重新加载页面,请在提交末尾添加以下内容:window.location.reload();
也许可以帮忙
答案 1 :(得分:0)
我设法使用:
解决了问题this.router.navigateByUrl('/RefreshComponent', { skipLocationChange: true }).then(() => {
this.router.navigate(['Your actualComponent']);
});