@@ -33,6 +33,7 @@ import {Platform} from '../core/platform/index';
3333import 'rxjs/add/operator/first' ;
3434import { ScrollDispatcher } from '../core/overlay/scroll/scroll-dispatcher' ;
3535import { Subscription } from 'rxjs/Subscription' ;
36+ import { coerceBooleanProperty } from '../core/coercion/boolean-property' ;
3637
3738export type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' | 'after' ;
3839
@@ -62,6 +63,7 @@ export class MdTooltip implements OnInit, OnDestroy {
6263 scrollSubscription : Subscription ;
6364
6465 private _position : TooltipPosition = 'below' ;
66+ private _disabled : boolean = false ;
6567
6668 /** Allows the user to define the position of the tooltip relative to the parent element */
6769 @Input ( 'mdTooltipPosition' )
@@ -78,6 +80,18 @@ export class MdTooltip implements OnInit, OnDestroy {
7880 }
7981 }
8082
83+ /** Disables the display of the tooltip. */
84+ @Input ( 'mdTooltipDisabled' )
85+ get disabled ( ) : boolean { return this . _disabled ; }
86+ set disabled ( value ) {
87+ this . _disabled = coerceBooleanProperty ( value ) ;
88+
89+ // If tooltip is disabled, hide immediately.
90+ if ( this . _disabled ) {
91+ this . hide ( 0 ) ;
92+ }
93+ }
94+
8195 /** @deprecated */
8296 @Input ( 'tooltip-position' )
8397 get _positionDeprecated ( ) : TooltipPosition { return this . _position ; }
@@ -115,6 +129,11 @@ export class MdTooltip implements OnInit, OnDestroy {
115129 get _matPosition ( ) { return this . position ; }
116130 set _matPosition ( v ) { this . position = v ; }
117131
132+ // Properties with `mat-` prefix for noconflict mode.
133+ @Input ( 'matTooltipDisabled' )
134+ get _matDisabled ( ) { return this . disabled ; }
135+ set _matDisabled ( v ) { this . disabled = v ; }
136+
118137 // Properties with `mat-` prefix for noconflict mode.
119138 @Input ( 'matTooltipHideDelay' )
120139 get _matHideDelay ( ) { return this . hideDelay ; }
@@ -168,7 +187,7 @@ export class MdTooltip implements OnInit, OnDestroy {
168187
169188 /** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
170189 show ( delay : number = this . showDelay ) : void {
171- if ( ! this . _message || ! this . _message . trim ( ) ) { return ; }
190+ if ( this . disabled || ! this . _message || ! this . _message . trim ( ) ) { return ; }
172191
173192 if ( ! this . _tooltipInstance ) {
174193 this . _createTooltip ( ) ;
@@ -192,7 +211,7 @@ export class MdTooltip implements OnInit, OnDestroy {
192211
193212 /** Returns true if the tooltip is currently visible to the user */
194213 _isTooltipVisible ( ) : boolean {
195- return this . _tooltipInstance && this . _tooltipInstance . isVisible ( ) ;
214+ return ! ! this . _tooltipInstance && this . _tooltipInstance . isVisible ( ) ;
196215 }
197216
198217 /** Create the tooltip to display */
0 commit comments