Skip to content

Commit 70730d9

Browse files
NathanWalkerAlexander Vakrilov
authored and
Alexander Vakrilov
committed
fix(modal): throw from tns-core-modules is now properly caught and rejected
1 parent dc8080b commit 70730d9

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

Diff for: nativescript-angular/directives/dialogs.ts

+19-13
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,25 @@ export class ModalDialogService {
7676

7777
this.location._beginModalNavigation();
7878

79-
return new Promise(resolve => {
80-
setTimeout(() => this._showDialog({
81-
containerRef: viewContainerRef,
82-
context,
83-
doneCallback: resolve,
84-
fullscreen,
85-
animated,
86-
stretched,
87-
pageFactory,
88-
parentView,
89-
resolver,
90-
type,
91-
}), 10);
79+
return new Promise((resolve, reject) => {
80+
setTimeout(() => {
81+
try {
82+
this._showDialog({
83+
containerRef: viewContainerRef,
84+
context,
85+
doneCallback: resolve,
86+
fullscreen,
87+
animated,
88+
stretched,
89+
pageFactory,
90+
parentView,
91+
resolver,
92+
type,
93+
});
94+
} catch (err) {
95+
reject(err);
96+
}
97+
}, 10);
9298
});
9399
}
94100

0 commit comments

Comments
 (0)