我有一个有角的DialogueService,它会打开一个弹出窗口,该弹出窗口有一个字段,一旦单击“是”,必须捕获其文本,我该如何将值从dialogservice传递回父级
this.popupservice.addDialog(Component,
{
title: 'Confirmation',
message: 'test'
})
.subscribe((isConfirmed) => {
if (isConfirmed) {
// catch returnText here
return true;
} else {
return false;
}
});
export interface CompModel {
title: string;
message: string;
returnText: string;
}
export class Component extends
PopupComponent<CompModel, boolean>{
implements CompModel {
title: string;
message: string;
returnText: string
confirm() {
// send return from here
this.close();
}
}
答案 0 :(得分:0)
简单来说,您可以在服务层中使用EventEmitter并从服务中接收任何事件。
答案 1 :(得分:0)
您可以在close()
方法中将该值作为参数传递,并且可以在subscription
中访问该值。检查文档。