File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,9 @@ function createAlertDialogBuilder(options?: DialogOptions & MDCAlertControlerOpt
6565 : Builder . createViewFromEntry ( {
6666 moduleName : options . view as string
6767 } ) ;
68-
68+ if ( view . parent ) {
69+ view . parent . _removeView ( view )
70+ }
6971 view . cssClasses . add ( CSSUtils . MODAL_ROOT_VIEW_CSS_CLASS ) ;
7072 const modalRootViewCssClasses = CSSUtils . getSystemCssClasses ( ) ;
7173 modalRootViewCssClasses . forEach ( ( c ) => view . cssClasses . add ( c ) ) ;
@@ -170,9 +172,7 @@ function prepareAndCreateAlertDialog(
170172 return ;
171173 }
172174 if ( onDoneCalled ) {
173- if ( toBeCalledBeforeCallback ) {
174- toBeCalledBeforeCallback ( ) ;
175- }
175+ toBeCalledBeforeCallback ?.( ) ;
176176 return ;
177177 }
178178 //ensure we hide any keyboard
@@ -191,9 +191,8 @@ function prepareAndCreateAlertDialog(
191191 if ( dialog ) {
192192 dialog . cancel ( ) ;
193193 }
194- if ( toBeCalledBeforeCallback ) {
195- toBeCalledBeforeCallback ( ) ;
196- }
194+ toBeCalledBeforeCallback ?.( ) ;
195+
197196 callback && callback ( result ) ;
198197 } ;
199198 if ( ! DialogInterface ) {
Original file line number Diff line number Diff line change @@ -217,7 +217,9 @@ function createAlertController(options: DialogOptions & MDCAlertControlerOptions
217217 : Builder . createViewFromEntry ( {
218218 moduleName : options . view as string
219219 } ) ;
220-
220+ if ( view . parent ) {
221+ view . parent . _removeView ( view )
222+ }
221223 view . cssClasses . add ( CSSUtils . MODAL_ROOT_VIEW_CSS_CLASS ) ;
222224 const modalRootViewCssClasses = CSSUtils . getSystemCssClasses ( ) ;
223225 modalRootViewCssClasses . forEach ( ( c ) => view . cssClasses . add ( c ) ) ;
You can’t perform that action at this time.
0 commit comments