【发布时间】:2018-11-13 15:53:04
【问题描述】:
我有一个使用模态服务的模态:
import { ModalDialogService } from "nativescript-angular/directives/dialogs";
private modal: ModalDialogService,
我可以调用一个模态,例如
this.modal.showModal(MyModalComponent, options).then(res => {
// console.log(res);
});
现在我想关闭模态,但不是从模态本身内部。这已经在 iOS 中有效:
const page = topmost().currentPage;
if (page && page.modal) {
page.modal.closeModal();
} else {
console.log("error closing modal!!!!");
}
但是在 Android 上运行它,它总是会出现错误 console.log,导致模态不被关闭。用户仍然可以关闭它(模态框有一个关闭按钮),但我也想以编程方式关闭模态框。
【问题讨论】:
标签: android angular modal-dialog nativescript