@@ -22,6 +22,9 @@ import {
2222 ViewEncapsulation ,
2323 ChangeDetectionStrategy ,
2424 ChangeDetectorRef ,
25+ ContentChildren ,
26+ QueryList ,
27+ forwardRef ,
2528} from '@angular/core' ;
2629import { MdInkBar } from '../ink-bar' ;
2730import { CanDisable , mixinDisabled } from '../../core/common-behaviors/disabled' ;
@@ -35,13 +38,15 @@ import {takeUntil, auditTime} from '../../core/rxjs/index';
3538import { of as observableOf } from 'rxjs/observable/of' ;
3639import { merge } from 'rxjs/observable/merge' ;
3740import { fromEvent } from 'rxjs/observable/fromEvent' ;
41+ import { CanDisableRipple , mixinDisableRipple } from '../../core/common-behaviors/disable-ripple' ;
42+ import { coerceBooleanProperty } from '@angular/cdk/coercion' ;
3843
3944// Boilerplate for applying mixins to MdTabNav.
4045/** @docs -private */
4146export class MdTabNavBase {
4247 constructor ( public _renderer : Renderer2 , public _elementRef : ElementRef ) { }
4348}
44- export const _MdTabNavMixinBase = mixinColor ( MdTabNavBase , 'primary' ) ;
49+ export const _MdTabNavMixinBase = mixinDisableRipple ( mixinColor ( MdTabNavBase , 'primary' ) ) ;
4550
4651/**
4752 * Navigation component matching the styles of the tab group header.
@@ -50,14 +55,16 @@ export const _MdTabNavMixinBase = mixinColor(MdTabNavBase, 'primary');
5055@Component ( {
5156 moduleId : module . id ,
5257 selector : '[md-tab-nav-bar], [mat-tab-nav-bar]' ,
53- inputs : [ 'color' ] ,
58+ inputs : [ 'color' , 'disableRipple' ] ,
5459 templateUrl : 'tab-nav-bar.html' ,
5560 styleUrls : [ 'tab-nav-bar.css' ] ,
5661 host : { 'class' : 'mat-tab-nav-bar' } ,
5762 encapsulation : ViewEncapsulation . None ,
5863 changeDetection : ChangeDetectionStrategy . OnPush ,
5964} )
60- export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit , CanColor , OnDestroy {
65+ export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit , CanColor ,
66+ CanDisableRipple , OnDestroy {
67+
6168 /** Subject that emits when the component has been destroyed. */
6269 private _onDestroy = new Subject < void > ( ) ;
6370
@@ -66,6 +73,10 @@ export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit, Ca
6673
6774 @ViewChild ( MdInkBar ) _inkBar : MdInkBar ;
6875
76+ /** Query list of all tab links of the tab navigation. */
77+ @ContentChildren ( forwardRef ( ( ) => MdTabLink ) , { descendants : true } )
78+ _tabLinks : QueryList < MdTabLink > ;
79+
6980 /** Subscription for window.resize event **/
7081 private _resizeSubscription : Subscription ;
7182
@@ -85,6 +96,14 @@ export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit, Ca
8596 }
8697 private _backgroundColor : ThemePalette ;
8798
99+ /** Whether ripples should be disabled for all links or not. */
100+ get disableRipple ( ) { return this . _disableRipple ; }
101+ set disableRipple ( value : boolean ) {
102+ this . _disableRipple = coerceBooleanProperty ( value ) ;
103+ this . _setLinkDisableRipple ( ) ;
104+ }
105+ private _disableRipple : boolean = false ;
106+
88107 constructor ( renderer : Renderer2 ,
89108 elementRef : ElementRef ,
90109 @Optional ( ) private _dir : Directionality ,
@@ -113,6 +132,7 @@ export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit, Ca
113132 return takeUntil . call ( merge ( dirChange , resize ) , this . _onDestroy )
114133 . subscribe ( ( ) => this . _alignInkBar ( ) ) ;
115134 } ) ;
135+ this . _setLinkDisableRipple ( ) ;
116136 }
117137
118138 /** Checks if the active link has been changed and, if so, will update the ink bar. */
@@ -137,6 +157,13 @@ export class MdTabNav extends _MdTabNavMixinBase implements AfterContentInit, Ca
137157 this . _inkBar . alignToElement ( this . _activeLinkElement . nativeElement ) ;
138158 }
139159 }
160+
161+ /** Sets the `disableRipple` property on each link of the navigation bar. */
162+ private _setLinkDisableRipple ( ) {
163+ if ( this . _tabLinks ) {
164+ this . _tabLinks . forEach ( link => link . disableRipple = this . disableRipple ) ;
165+ }
166+ }
140167}
141168
142169
@@ -160,6 +187,9 @@ export class MdTabLink extends _MdTabLinkMixinBase implements OnDestroy, CanDisa
160187 /** Whether the tab link is active or not. */
161188 private _isActive : boolean = false ;
162189
190+ /** Whether the ripples for this tab should be disabled or not. */
191+ private _disableRipple : boolean = false ;
192+
163193 /** Reference to the instance of the ripple for the tab link. */
164194 private _tabLinkRipple : MdRipple ;
165195
@@ -173,6 +203,14 @@ export class MdTabLink extends _MdTabLinkMixinBase implements OnDestroy, CanDisa
173203 }
174204 }
175205
206+ /** Whether ripples should be disabled or not. */
207+ get disableRipple ( ) : boolean { return this . _disableRipple ; }
208+ set disableRipple ( value : boolean ) {
209+ this . _disableRipple = value ;
210+ this . _tabLinkRipple . disabled = this . disableRipple ;
211+ this . _tabLinkRipple . _updateRippleRenderer ( ) ;
212+ }
213+
176214 /** @docs -private */
177215 @HostBinding ( 'tabIndex' )
178216 get tabIndex ( ) : number {
0 commit comments