File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
packages/angular/src/lib/cdk/dialog Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 77 */
88
99import { ViewContainerRef , ComponentFactoryResolver } from '@angular/core' ;
10- import { ShowModalOptions } from '@nativescript/core' ;
10+ import { ShowModalOptions , View } from '@nativescript/core' ;
1111
1212export type NativeShowModalOptions = Partial < Omit < ShowModalOptions , 'cancelable' | 'closeCallback' > > ;
1313/**
@@ -22,6 +22,9 @@ export class NativeDialogConfig<D = any> {
2222 */
2323 viewContainerRef ?: ViewContainerRef ;
2424
25+ /** Where to render the actual dialog in. By default it renders using the native view of the ViewContainerRef */
26+ renderIn : 'root' | 'viewContainerRef' | View = 'viewContainerRef' ;
27+
2528 /** ID for the dialog. If omitted, a unique one will be generated. */
2629 id ?: string ;
2730
Original file line number Diff line number Diff line change @@ -24,8 +24,13 @@ export class NativeModalRef {
2424 private _closeCallback : ( ) => void ;
2525 private _isDismissed = false ;
2626
27- constructor ( private _config : NativeDialogConfig , private _injector : Injector , @Optional ( ) private location ?: NSLocationStrategy ) {
28- let parentView = this . _config . viewContainerRef ?. element . nativeElement || Application . getRootView ( ) ;
27+ constructor (
28+ private _config : NativeDialogConfig ,
29+ private _injector : Injector ,
30+ @Optional ( ) private location ?: NSLocationStrategy ,
31+ ) {
32+ const nativeElement = this . _config . renderIn === 'root' ? Application . getRootView ( ) : this . _config . renderIn === 'viewContainerRef' ? this . _config . viewContainerRef ?. element . nativeElement : this . _config . renderIn ;
33+ let parentView = nativeElement || Application . getRootView ( ) ;
2934
3035 if ( ( parentView instanceof AppHostView || parentView instanceof AppHostAsyncView ) && parentView . ngAppRoot ) {
3136 parentView = parentView . ngAppRoot ;
You can’t perform that action at this time.
0 commit comments