0
我正在使用模块化窗口Angular。为了改变我的表中的数据。我该怎么做才能在事件发生后关闭数据保持不变。而在发生问题时,数据和现在的数据都被转移到了表格中?这里是我的代码:将数据从弹出窗口发送到网格Angular 2?
家长
modalRef.result.then((data) => {
this.gridOptions.api.refreshView();
});
}
弹出
saveEntity(): void {
if (this.RoleId.WorkedYears <= 0) {
this.toastr.error('Please enter positive number');
}
else {
this.RoleId.WorkedYears = this.RoleId.WorkedYears
this.activeModal.close();
}
}
close(): void {
this.activeModal.dismiss();
}
您可以使用一项服务来保存您的数据。这样,您可以通过依赖注入来注入服务,从而从不同的组件中访问它。 –
利用@AlexBeugnet指出的共享服务是最好的选择,我想最好有一个服务模型,当你关闭它时将被复制到网格中 –