File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
179179
180180 private _injector = inject ( Injector ) ;
181181
182- private _isDestroyed = false ;
182+ private _destroyRef = inject ( DestroyRef ) ;
183183
184184 constructor ( ...args : unknown [ ] ) ;
185185
@@ -211,7 +211,7 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
211211 // effect that runs before change detection of any application views (since we're depending on markForCheck marking parents dirty)
212212 { injector : inject ( ApplicationRef ) . injector } ,
213213 ) ;
214- inject ( DestroyRef ) . onDestroy ( ( ) => void ref . destroy ( ) ) ;
214+ this . _destroyRef . onDestroy ( ( ) => void ref . destroy ( ) ) ;
215215 }
216216
217217 override ngOnInit ( ) {
@@ -262,8 +262,6 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
262262 this . _detachedSubject . complete ( ) ;
263263 this . _viewportChanges . unsubscribe ( ) ;
264264
265- this . _isDestroyed = true ;
266-
267265 super . ngOnDestroy ( ) ;
268266 }
269267
@@ -512,7 +510,7 @@ export class CdkVirtualScrollViewport extends CdkVirtualScrollable implements On
512510
513511 /** Run change detection. */
514512 private _doChangeDetection ( ) {
515- if ( this . _isDestroyed ) {
513+ if ( this . _destroyRef . destroyed ) {
516514 return ;
517515 }
518516
You can’t perform that action at this time.
0 commit comments