@@ -24,9 +24,6 @@ import {
24
24
numberAttribute ,
25
25
Output ,
26
26
ANIMATION_MODULE_TYPE ,
27
- afterNextRender ,
28
- inject ,
29
- Injector ,
30
27
} from '@angular/core' ;
31
28
import { Direction , Directionality } from '@angular/cdk/bidi' ;
32
29
import { ViewportRuler } from '@angular/cdk/scrolling' ;
@@ -42,7 +39,7 @@ import {
42
39
timer ,
43
40
fromEvent ,
44
41
} from 'rxjs' ;
45
- import { switchMap , startWith , skip , takeUntil , filter } from 'rxjs/operators' ;
42
+ import { take , switchMap , startWith , skip , takeUntil , filter } from 'rxjs/operators' ;
46
43
import { Platform , normalizePassiveListenerOptions } from '@angular/cdk/platform' ;
47
44
48
45
/** Config used to bind passive event listeners */
@@ -156,8 +153,6 @@ export abstract class MatPaginatedTabHeader
156
153
/** Event emitted when a label is focused. */
157
154
@Output ( ) readonly indexFocused : EventEmitter < number > = new EventEmitter < number > ( ) ;
158
155
159
- private _injector = inject ( Injector ) ;
160
-
161
156
constructor (
162
157
protected _elementRef : ElementRef < HTMLElement > ,
163
158
protected _changeDetectorRef : ChangeDetectorRef ,
@@ -214,9 +209,9 @@ export abstract class MatPaginatedTabHeader
214
209
215
210
// Defer the first call in order to allow for slower browsers to lay out the elements.
216
211
// This helps in cases where the user lands directly on a page with paginated tabs.
217
- // TODO(mmalerba): Consider breaking this into multiple `afterNextRender` calls with explicit
218
- // phase .
219
- afterNextRender ( realign , { injector : this . _injector } ) ;
212
+ // Note that we use `onStable` instead of `requestAnimationFrame`, because the latter
213
+ // can hold up tests that are in a background tab .
214
+ this . _ngZone . onStable . pipe ( take ( 1 ) ) . subscribe ( realign ) ;
220
215
221
216
// On dir change or window resize, realign the ink bar and update the orientation of
222
217
// the key manager if the direction has changed.
0 commit comments