@@ -164,27 +164,18 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
164
164
private _changeDetectorRef : ChangeDetectorRef ,
165
165
private _viewportRuler : ViewportRuler ,
166
166
@Optional ( ) private _dir : Directionality ,
167
- // @breaking -change 8.0.0 `_ngZone` and `_platforms` parameters to be made required.
168
- private _ngZone ?: NgZone ,
169
- private _platform ?: Platform ) {
167
+ private _ngZone : NgZone ,
168
+ private _platform : Platform ) {
170
169
super ( ) ;
171
170
172
- const element = _elementRef . nativeElement ;
173
- const bindEvent = ( ) => {
174
- fromEvent ( element , 'mouseleave' )
171
+ // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
172
+ _ngZone . runOutsideAngular ( ( ) => {
173
+ fromEvent ( _elementRef . nativeElement , 'mouseleave' )
175
174
. pipe ( takeUntil ( this . _destroyed ) )
176
175
. subscribe ( ( ) => {
177
176
this . _stopInterval ( ) ;
178
177
} ) ;
179
- } ;
180
-
181
- // @breaking -change 8.0.0 remove null check once _ngZone is made into a required parameter.
182
- if ( _ngZone ) {
183
- // Bind the `mouseleave` event on the outside since it doesn't change anything in the view.
184
- _ngZone . runOutsideAngular ( bindEvent ) ;
185
- } else {
186
- bindEvent ( ) ;
187
- }
178
+ } ) ;
188
179
}
189
180
190
181
ngAfterContentChecked ( ) : void {
@@ -310,16 +301,13 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
310
301
if ( textContent !== this . _currentTextContent ) {
311
302
this . _currentTextContent = textContent ;
312
303
313
- const zoneCallback = ( ) => {
304
+ // The content observer runs outside the `NgZone` by default, which
305
+ // means that we need to bring the callback back in ourselves.
306
+ this . _ngZone . run ( ( ) => {
314
307
this . updatePagination ( ) ;
315
308
this . _alignInkBarToSelectedTab ( ) ;
316
309
this . _changeDetectorRef . markForCheck ( ) ;
317
- } ;
318
-
319
- // The content observer runs outside the `NgZone` by default, which
320
- // means that we need to bring the callback back in ourselves.
321
- // @breaking -change 8.0.0 Remove null check for `_ngZone` once it's a required parameter.
322
- this . _ngZone ? this . _ngZone . run ( zoneCallback ) : zoneCallback ( ) ;
310
+ } ) ;
323
311
}
324
312
}
325
313
@@ -410,8 +398,7 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
410
398
// position to be thrown off in some cases. We have to reset it ourselves to ensure that
411
399
// it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
412
400
// with the scroll position throws off Chrome 71+ in RTL mode (see #14689).
413
- // @breaking -change 8.0.0 Remove null check for `platform`.
414
- if ( platform && ( platform . TRIDENT || platform . EDGE ) ) {
401
+ if ( platform . TRIDENT || platform . EDGE ) {
415
402
this . _tabListContainer . nativeElement . scrollLeft = 0 ;
416
403
}
417
404
}
0 commit comments