1
- import { Component , ViewContainerRef , Input } from "@angular/core" ;
1
+ import { Component , ViewContainerRef , Input , ViewChild } from "@angular/core" ;
2
2
import { Router , NavigationEnd } from "@angular/router" ;
3
3
import { ModalDialogService , ModalDialogOptions } from "nativescript-angular/directives/dialogs" ;
4
4
import { ModalComponent } from "../modal/modal.component" ;
@@ -16,20 +16,22 @@ import { ModalViewComponent } from "~/modal-shared/modal-view.component";
16
16
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
17
17
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
18
18
<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>
20
21
</StackLayout>`
21
22
} )
22
23
23
24
export class BasicsNavigationComponent {
24
25
26
+ @ViewChild ( "popoverButtonComp" ) popoverButtonComp ;
25
27
@Input ( ) col : number ;
26
28
constructor (
27
29
private modal : ModalDialogService ,
28
30
private router : Router ,
29
31
private vcf : ViewContainerRef ,
30
32
private viewContainerRefService : ViewContainerRefService ) {
31
33
}
32
-
34
+
33
35
onModalNoFrame ( ) {
34
36
const options : ModalDialogOptions = {
35
37
context : {
@@ -74,14 +76,28 @@ export class BasicsNavigationComponent {
74
76
75
77
onRootModalTap ( ) : void {
76
78
const options : ModalDialogOptions = {
77
- viewContainerRef : this . viewContainerRefService . root ,
78
- context : { } ,
79
- fullscreen : true
79
+ viewContainerRef : this . viewContainerRefService . root ,
80
+ context : { } ,
81
+ fullscreen : true
80
82
} ;
81
-
83
+
82
84
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
+ }
87
103
}
0 commit comments