|
1 | 1 | import { Component, ViewContainerRef } from "@angular/core";
|
2 | 2 | import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs";
|
| 3 | +import { RouterExtensions } from "nativescript-angular/router"; |
3 | 4 | import { EventData } from "tns-core-modules/data/observable";
|
4 |
| -import { Frame } from "tns-core-modules/ui/frame"; |
5 |
| -import { View } from "tns-core-modules/ui/core/view"; |
| 5 | + |
| 6 | +import { ViewContainerRefService } from "../shared/ViewContainerRefService"; |
6 | 7 | import { ModalRouterComponent } from "../modal/modal-router/modal-router.component";
|
7 |
| -import { PageRouterOutlet } from "nativescript-angular/router/page-router-outlet"; |
8 |
| -import { RouterExtensions } from "nativescript-angular/router"; |
9 | 8 | import { ModalComponent } from "../modal/modal.component";
|
| 9 | +import { ModalViewComponent } from "../modal-shared/modal-view.component"; |
10 | 10 |
|
11 | 11 | @Component({
|
12 | 12 | moduleId: module.id,
|
13 | 13 | selector: "home-page",
|
14 | 14 | templateUrl: "./home.component.html"
|
15 | 15 | })
|
16 | 16 | export class HomeComponent {
|
17 |
| - constructor(private modal: ModalDialogService, private vcRef: ViewContainerRef, private routerExtension: RouterExtensions) { } |
| 17 | + constructor( |
| 18 | + private modal: ModalDialogService, |
| 19 | + private vcRef: ViewContainerRef, |
| 20 | + private viewContainerRefService: ViewContainerRefService, |
| 21 | + private routerExtension: RouterExtensions) { } |
18 | 22 |
|
19 | 23 | onModalNoFrame(args: EventData) {
|
20 | 24 | const options: ModalDialogOptions = {
|
@@ -52,4 +56,17 @@ export class HomeComponent {
|
52 | 56 | onFrameRootViewReset(args: EventData) {
|
53 | 57 |
|
54 | 58 | }
|
| 59 | + |
| 60 | + onRootModalTap(): void { |
| 61 | + const options: ModalDialogOptions = { |
| 62 | + viewContainerRef: this.viewContainerRefService.root, |
| 63 | + context: {}, |
| 64 | + fullscreen: true |
| 65 | + }; |
| 66 | + |
| 67 | + this.modal.showModal(ModalViewComponent, options) |
| 68 | + .then((result: string) => { |
| 69 | + console.log(result); |
| 70 | + }); |
| 71 | + } |
55 | 72 | }
|
0 commit comments