@@ -26,7 +26,6 @@ import {
2626 LView ,
2727 LViewFlags ,
2828 PARENT ,
29- REACTIVE_TEMPLATE_CONSUMER ,
3029 TVIEW ,
3130} from './interfaces/view' ;
3231import { destroyLView , detachMovedView , detachViewFromDOM } from './node_manipulation' ;
@@ -35,6 +34,7 @@ import {
3534 markViewForRefresh ,
3635 storeLViewOnDestroy ,
3736 updateAncestorTraversalFlagsOnAttach ,
37+ requiresRefreshOrTraversal ,
3838} from './util/view_utils' ;
3939import { detachView , trackMovedView } from './view/container' ;
4040
@@ -81,18 +81,6 @@ export class ViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorRefInterfac
8181 return this . _lView [ CONTEXT ] as unknown as T ;
8282 }
8383
84- /**
85- * Reports whether the given view is considered dirty according to the different marking mechanisms.
86- */
87- get dirty ( ) : boolean {
88- return (
89- ! ! (
90- this . _lView [ FLAGS ] &
91- ( LViewFlags . Dirty | LViewFlags . RefreshView | LViewFlags . HasChildViewsToRefresh )
92- ) || ! ! this . _lView [ REACTIVE_TEMPLATE_CONSUMER ] ?. dirty
93- ) ;
94- }
95-
9684 /**
9785 * @deprecated Replacing the full context object is not supported. Modify the context
9886 * directly, or consider using a `Proxy` if you need to replace the full object.
@@ -177,10 +165,6 @@ export class ViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorRefInterfac
177165 markViewDirty ( this . _cdRefInjectingView || this . _lView , NotificationSource . MarkForCheck ) ;
178166 }
179167
180- markForRefresh ( ) : void {
181- markViewForRefresh ( this . _cdRefInjectingView || this . _lView ) ;
182- }
183-
184168 /**
185169 * Detaches the view from the change detection tree.
186170 *
@@ -382,3 +366,14 @@ export class ViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorRefInterfac
382366 updateAncestorTraversalFlagsOnAttach ( this . _lView ) ;
383367 }
384368}
369+
370+ /**
371+ * Reports whether the given view is considered dirty according to the different marking mechanisms.
372+ */
373+ export function isViewDirty ( view : ViewRef < unknown > ) : boolean {
374+ return requiresRefreshOrTraversal ( view . _lView ) || ! ! ( view . _lView [ FLAGS ] & LViewFlags . Dirty ) ;
375+ }
376+
377+ export function markForRefresh ( view : ViewRef < unknown > ) : void {
378+ markViewForRefresh ( view [ '_cdRefInjectingView' ] || view . _lView ) ;
379+ }
0 commit comments