diff --git a/e2e/modal-navigation-ng/app/modal/modal.component.html b/e2e/modal-navigation-ng/app/modal/modal.component.html
index 342c2cc03..2077becc8 100644
--- a/e2e/modal-navigation-ng/app/modal/modal.component.html
+++ b/e2e/modal-navigation-ng/app/modal/modal.component.html
@@ -6,7 +6,7 @@
-
+
diff --git a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
index 9cd95bea6..945cc4431 100644
--- a/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
+++ b/e2e/modal-navigation-ng/e2e/modal-layout.e2e-spec.ts
@@ -45,6 +45,10 @@ describe("modal-layout:", () => {
await screen.loadedHome();
});
+ it("should show nested modal page, run in background, close", async () => {
+ await testNestedModalPageBackground(driver, screen, false);
+ });
+
it("should show dialog confirm inside modal view with no frame, run in background", async () => {
await testDialogBackground(driver, screen, false);
});
diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts
index 961ca362b..4fc954c96 100644
--- a/nativescript-angular/directives/dialogs.ts
+++ b/nativescript-angular/directives/dialogs.ts
@@ -67,6 +67,13 @@ export class ModalDialogService {
parentView = parentView.ngAppRoot;
}
+ // _ngDialogRoot is the first child of the previously detached proxy.
+ // It should have 'viewController' (iOS) or '_dialogFragment' (Android) available for
+ // presenting future modal views.
+ if (parentView._ngDialogRoot) {
+ parentView = parentView._ngDialogRoot;
+ }
+
const pageFactory: PageFactory = viewContainerRef.injector.get(PAGE_FACTORY);
// resolve from particular module (moduleRef)
@@ -76,7 +83,9 @@ export class ModalDialogService {
const frame = parentView.page && parentView.page.frame;
- this.location._beginModalNavigation(frame);
+ if (frame) {
+ this.location._beginModalNavigation(frame);
+ }
return new Promise((resolve, reject) => {
setTimeout(() => {
@@ -144,6 +153,7 @@ export class ModalDialogService {
componentView = detachedProxy.getChildAt(0);
if (componentView.parent) {
+ (componentView.parent)._ngDialogRoot = componentView;
(componentView.parent).removeChild(componentView);
}
diff --git a/tests/app/tests/ns-location-strategy.ts b/tests/app/tests/ns-location-strategy.ts
index 01824f0ec..e85ff327a 100644
--- a/tests/app/tests/ns-location-strategy.ts
+++ b/tests/app/tests/ns-location-strategy.ts
@@ -36,7 +36,7 @@ export class FakeFrame extends View implements Frame {
}
}
- navigate(entry: any) {}
+ navigate(entry: any) { }
constructor(private backCB?: () => void) {
super();
@@ -70,10 +70,15 @@ export class FakeFrame extends View implements Frame {
_findEntryForTag(fragmentTag: string): BackstackEntry {
throw new Error("I am a FakeFrame");
}
-
_updateBackstack(entry: BackstackEntry, isBack: boolean): void {
throw new Error("I am a FakeFrame");
}
+ _pushInFrameStack() {
+ throw new Error("I am a FakeFrame");
+ }
+ _removeFromFrameStack() {
+ throw new Error("I am a FakeFrame");
+ }
}
function initStrategy(initUrl: string, back?: () => void): NSLocationStrategy {