@@ -21,6 +21,7 @@ import {
2121 AfterContentInit ,
2222 OnDestroy ,
2323 NgZone ,
24+ Renderer2 ,
2425} from '@angular/core' ;
2526import {
2627 RIGHT_ARROW ,
@@ -136,6 +137,7 @@ export class MdTabHeader implements AfterContentChecked, AfterContentInit, OnDes
136137 constructor (
137138 private _elementRef : ElementRef ,
138139 private _ngZone : NgZone ,
140+ private _renderer : Renderer2 ,
139141 @Optional ( ) private _dir : Directionality ) { }
140142
141143 ngAfterContentChecked ( ) : void {
@@ -299,12 +301,11 @@ export class MdTabHeader implements AfterContentChecked, AfterContentInit, OnDes
299301
300302 /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
301303 _updateTabScrollPosition ( ) {
302- let translateX = this . scrollDistance + 'px' ;
303- if ( this . _getLayoutDirection ( ) == 'ltr' ) {
304- translateX = '-' + translateX ;
305- }
304+ const scrollDistance = this . scrollDistance ;
305+ const translateX = this . _getLayoutDirection ( ) === 'ltr' ? - scrollDistance : scrollDistance ;
306306
307- applyCssTransform ( this . _tabList . nativeElement , `translate3d(${ translateX } , 0, 0)` ) ;
307+ this . _renderer . setStyle ( this . _tabList . nativeElement , 'transform' ,
308+ `translate3d(${ translateX } px, 0, 0)` ) ;
308309 }
309310
310311 /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
@@ -317,7 +318,7 @@ export class MdTabHeader implements AfterContentChecked, AfterContentInit, OnDes
317318
318319 this . _checkScrollingControls ( ) ;
319320 }
320- get scrollDistance ( ) : number { return this . _scrollDistance ; }
321+ get scrollDistance ( ) : number { return this . _scrollDistance ; }
321322
322323 /**
323324 * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
@@ -413,7 +414,7 @@ export class MdTabHeader implements AfterContentChecked, AfterContentInit, OnDes
413414 _getMaxScrollDistance ( ) : number {
414415 const lengthOfTabList = this . _tabList . nativeElement . scrollWidth ;
415416 const viewLength = this . _tabListContainer . nativeElement . offsetWidth ;
416- return lengthOfTabList - viewLength ;
417+ return ( lengthOfTabList - viewLength ) || 0 ;
417418 }
418419
419420 /** Tells the ink-bar to align itself to the current label wrapper */
0 commit comments