From 70730d9c3736985410bdbcbc7123da4bec85be94 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 21 May 2018 08:32:00 -0700 Subject: [PATCH] fix(modal): throw from tns-core-modules is now properly caught and rejected --- nativescript-angular/directives/dialogs.ts | 32 +++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts index 0365ff2a3..612b2788b 100644 --- a/nativescript-angular/directives/dialogs.ts +++ b/nativescript-angular/directives/dialogs.ts @@ -76,19 +76,25 @@ export class ModalDialogService { this.location._beginModalNavigation(); - return new Promise(resolve => { - setTimeout(() => this._showDialog({ - containerRef: viewContainerRef, - context, - doneCallback: resolve, - fullscreen, - animated, - stretched, - pageFactory, - parentView, - resolver, - type, - }), 10); + return new Promise((resolve, reject) => { + setTimeout(() => { + try { + this._showDialog({ + containerRef: viewContainerRef, + context, + doneCallback: resolve, + fullscreen, + animated, + stretched, + pageFactory, + parentView, + resolver, + type, + }); + } catch (err) { + reject(err); + } + }, 10); }); }