Skip to content

Commit 4e33561

Browse files
authored
fix: use changeDetectorRef.detectChanges() instead of detectChanges() private api (#99)
1 parent 6623002 commit 4e33561

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/angular/src/lib/cdk/dialog/native-modal-ref.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core';
2-
import { ContentView, View, Application, Frame } from '@nativescript/core';
1+
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef } from '@angular/core';
2+
import { Application, ContentView, Frame, View } from '@nativescript/core';
33
import { fromEvent, Subject } from 'rxjs';
44
import { take } from 'rxjs/operators';
55
import { AppHostAsyncView, AppHostView } from '../../app-host-view';
66
import { NSLocationStrategy } from '../../legacy/router/ns-location-strategy';
77
import { once } from '../../utils/general';
8+
import { NgViewRef } from '../../view-refs';
89
import { DetachedLoader } from '../detached-loader';
910
import { ComponentPortal, TemplatePortal } from '../portal/common';
1011
import { NativeScriptDomPortalOutlet } from '../portal/nsdom-portal-outlet';
1112
import { NativeDialogConfig } from './dialog-config';
12-
import { NgViewRef } from '../../view-refs';
1313

1414
export class NativeModalRef {
1515
_id: string;
@@ -103,7 +103,7 @@ export class NativeModalRef {
103103
const targetView = new ContentView();
104104
this.portalOutlet = new NativeScriptDomPortalOutlet(targetView, this._config.componentFactoryResolver || this._injector.get(ComponentFactoryResolver), this._injector.get(ApplicationRef), this._injector);
105105
const componentRef = this.portalOutlet.attach(portal);
106-
detectChanges(componentRef.instance);
106+
componentRef.changeDetectorRef.detectChanges();
107107
this.modalViewRef = new NgViewRef(componentRef);
108108
if (this.modalViewRef.firstNativeLikeView !== this.modalViewRef.view) {
109109
(<any>this.modalViewRef.view)._ngDialogRoot = this.modalViewRef.firstNativeLikeView;

packages/angular/src/lib/legacy/directives/dialogs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core';
1+
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef } from '@angular/core';
22
import { Application, ContentView, Frame, ShowModalOptions, View, ViewBase } from '@nativescript/core';
33
import { Subject } from 'rxjs';
44
import { AppHostAsyncView, AppHostView } from '../../app-host-view';
@@ -169,7 +169,7 @@ export class ModalDialogService {
169169
const portal = new ComponentPortal(options.type);
170170
portalOutlet = new NativeScriptDomPortalOutlet(targetView, options.resolver, this.appRef, childInjector);
171171
const componentRef = portalOutlet.attach(portal);
172-
detectChanges(componentRef.instance);
172+
componentRef.changeDetectorRef.detectChanges();
173173
componentViewRef = new NgViewRef(componentRef);
174174
if (options.useContextAsComponentProps && options.context) {
175175
for (const key in options.context) {

0 commit comments

Comments
 (0)