@@ -31,6 +31,7 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
31
31
ctrl . shouldCenterTabs = shouldCenterTabs ( ) ;
32
32
33
33
//-- define public methods
34
+ ctrl . updatePagination = $mdUtil . debounce ( updatePagination , 100 ) ;
34
35
ctrl . redirectFocus = redirectFocus ;
35
36
ctrl . attachRipple = attachRipple ;
36
37
ctrl . shouldStretchTabs = shouldStretchTabs ;
@@ -79,7 +80,7 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
79
80
function bindEvents ( ) {
80
81
angular . element ( $window ) . on ( 'resize' , handleWindowResize ) ;
81
82
angular . element ( elements . paging ) . on ( 'DOMSubtreeModified' , ctrl . updateInkBarStyles ) ;
82
- angular . element ( elements . paging ) . on ( 'DOMSubtreeModified' , updatePagination ) ;
83
+ angular . element ( elements . paging ) . on ( 'DOMSubtreeModified' , ctrl . updatePagination ) ;
83
84
}
84
85
85
86
function configureWatchers ( ) {
@@ -569,11 +570,9 @@ function MdTabsController ($scope, $element, $window, $timeout, $mdConstant, $md
569
570
oldIndex = ctrl . lastSelectedIndex ,
570
571
ink = angular . element ( elements . inkBar ) ;
571
572
if ( ! angular . isNumber ( oldIndex ) ) return ;
572
- if ( newIndex < oldIndex ) {
573
- ink . addClass ( 'md-left' ) . removeClass ( 'md-right' ) ;
574
- } else if ( newIndex > oldIndex ) {
575
- ink . addClass ( 'md-right' ) . removeClass ( 'md-left' ) ;
576
- }
573
+ ink
574
+ . toggleClass ( 'md-left' , newIndex < oldIndex )
575
+ . toggleClass ( 'md-right' , newIndex > oldIndex ) ;
577
576
}
578
577
579
578
/**
0 commit comments