From 46c9809050783481e1c3502acc1ddb860d92a2ba Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 23 Nov 2022 16:06:13 -0300 Subject: [PATCH] fix: use changeDetectorRef.detectChanges() instead of detectChanges() private api --- packages/angular/src/lib/cdk/dialog/native-modal-ref.ts | 8 ++++---- packages/angular/src/lib/legacy/directives/dialogs.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/angular/src/lib/cdk/dialog/native-modal-ref.ts b/packages/angular/src/lib/cdk/dialog/native-modal-ref.ts index 4807ac1..3e7104f 100644 --- a/packages/angular/src/lib/cdk/dialog/native-modal-ref.ts +++ b/packages/angular/src/lib/cdk/dialog/native-modal-ref.ts @@ -1,15 +1,15 @@ -import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core'; -import { ContentView, View, Application, Frame } from '@nativescript/core'; +import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injector, Optional, ViewContainerRef } from '@angular/core'; +import { Application, ContentView, Frame, View } from '@nativescript/core'; import { fromEvent, Subject } from 'rxjs'; import { take } from 'rxjs/operators'; import { AppHostAsyncView, AppHostView } from '../../app-host-view'; import { NSLocationStrategy } from '../../legacy/router/ns-location-strategy'; import { once } from '../../utils/general'; +import { NgViewRef } from '../../view-refs'; import { DetachedLoader } from '../detached-loader'; import { ComponentPortal, TemplatePortal } from '../portal/common'; import { NativeScriptDomPortalOutlet } from '../portal/nsdom-portal-outlet'; import { NativeDialogConfig } from './dialog-config'; -import { NgViewRef } from '../../view-refs'; export class NativeModalRef { _id: string; @@ -103,7 +103,7 @@ export class NativeModalRef { const targetView = new ContentView(); this.portalOutlet = new NativeScriptDomPortalOutlet(targetView, this._config.componentFactoryResolver || this._injector.get(ComponentFactoryResolver), this._injector.get(ApplicationRef), this._injector); const componentRef = this.portalOutlet.attach(portal); - detectChanges(componentRef.instance); + componentRef.changeDetectorRef.detectChanges(); this.modalViewRef = new NgViewRef(componentRef); if (this.modalViewRef.firstNativeLikeView !== this.modalViewRef.view) { (this.modalViewRef.view)._ngDialogRoot = this.modalViewRef.firstNativeLikeView; diff --git a/packages/angular/src/lib/legacy/directives/dialogs.ts b/packages/angular/src/lib/legacy/directives/dialogs.ts index 7542731..3ec523b 100644 --- a/packages/angular/src/lib/legacy/directives/dialogs.ts +++ b/packages/angular/src/lib/legacy/directives/dialogs.ts @@ -1,4 +1,4 @@ -import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef, ɵdetectChanges as detectChanges } from '@angular/core'; +import { ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable, Injector, NgModuleRef, NgZone, Type, ViewContainerRef } from '@angular/core'; import { Application, ContentView, Frame, ShowModalOptions, View, ViewBase } from '@nativescript/core'; import { Subject } from 'rxjs'; import { AppHostAsyncView, AppHostView } from '../../app-host-view'; @@ -169,7 +169,7 @@ export class ModalDialogService { const portal = new ComponentPortal(options.type); portalOutlet = new NativeScriptDomPortalOutlet(targetView, options.resolver, this.appRef, childInjector); const componentRef = portalOutlet.attach(portal); - detectChanges(componentRef.instance); + componentRef.changeDetectorRef.detectChanges(); componentViewRef = new NgViewRef(componentRef); if (options.useContextAsComponentProps && options.context) { for (const key in options.context) {