1- import { Component , ViewContainerRef , Input } from "@angular/core" ;
1+ import { Component , ViewContainerRef , Input , ViewChild } from "@angular/core" ;
22import { Router , NavigationEnd } from "@angular/router" ;
33import { ModalDialogService , ModalDialogOptions } from "nativescript-angular/directives/dialogs" ;
44import { ModalComponent } from "../modal/modal.component" ;
@@ -16,20 +16,22 @@ import { ModalViewComponent } from "~/modal-shared/modal-view.component";
1616 <Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
1717 <Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
1818 <Button text="Show Shared Modal" (tap)="onRootModalTap()" textAlignment="left"></Button>
19- <Button text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
19+ <Button #popoverButtonComp text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
20+ <Button text="Show 'popover' modal" (tap)="onPopoverModal()" textAlignment="left"></Button>
2021</StackLayout>`
2122} )
2223
2324export class BasicsNavigationComponent {
2425
26+ @ViewChild ( "popoverButtonComp" ) popoverButtonComp ;
2527 @Input ( ) col : number ;
2628 constructor (
2729 private modal : ModalDialogService ,
2830 private router : Router ,
2931 private vcf : ViewContainerRef ,
3032 private viewContainerRefService : ViewContainerRefService ) {
3133 }
32-
34+
3335 onModalNoFrame ( ) {
3436 const options : ModalDialogOptions = {
3537 context : {
@@ -74,14 +76,28 @@ export class BasicsNavigationComponent {
7476
7577 onRootModalTap ( ) : void {
7678 const options : ModalDialogOptions = {
77- viewContainerRef : this . viewContainerRefService . root ,
78- context : { } ,
79- fullscreen : true
79+ viewContainerRef : this . viewContainerRefService . root ,
80+ context : { } ,
81+ fullscreen : true
8082 } ;
81-
83+
8284 this . modal . showModal ( ModalViewComponent , options )
83- . then ( ( result : string ) => {
84- console . log ( result ) ;
85- } ) ;
86- }
85+ . then ( ( result : string ) => {
86+ console . log ( result ) ;
87+ } ) ;
88+ }
89+
90+ onPopoverModal ( ) {
91+ const options : ModalDialogOptions = {
92+ viewContainerRef : this . viewContainerRefService . root ,
93+ context : { } ,
94+ ios : {
95+ presentationStyle : UIModalPresentationStyle . Popover
96+ } ,
97+ sourceView : this . popoverButtonComp
98+ } ;
99+
100+ this . modal . showModal ( ModalViewComponent , options )
101+ . then ( ( result : string ) => { console . log ( result ) ; } ) ;
102+ }
87103}
0 commit comments