@@ -164,27 +164,18 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
164164 private _changeDetectorRef : ChangeDetectorRef ,
165165 private _viewportRuler : ViewportRuler ,
166166 @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 ) {
170169 super ( ) ;
171170
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' )
175174 . pipe ( takeUntil ( this . _destroyed ) )
176175 . subscribe ( ( ) => {
177176 this . _stopInterval ( ) ;
178177 } ) ;
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+ } ) ;
188179 }
189180
190181 ngAfterContentChecked ( ) : void {
@@ -310,16 +301,13 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
310301 if ( textContent !== this . _currentTextContent ) {
311302 this . _currentTextContent = textContent ;
312303
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 ( ( ) => {
314307 this . updatePagination ( ) ;
315308 this . _alignInkBarToSelectedTab ( ) ;
316309 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+ } ) ;
323311 }
324312 }
325313
@@ -410,8 +398,7 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
410398 // position to be thrown off in some cases. We have to reset it ourselves to ensure that
411399 // it doesn't get thrown off. Note that we scope it only to IE and Edge, because messing
412400 // 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 ) {
415402 this . _tabListContainer . nativeElement . scrollLeft = 0 ;
416403 }
417404 }
0 commit comments