@@ -15,6 +15,7 @@ import {
1515 NgZone ,
1616 Optional ,
1717 OnDestroy ,
18+ Renderer ,
1819 OnInit ,
1920 ChangeDetectorRef
2021} from '@angular/core' ;
@@ -32,6 +33,7 @@ import {MdTooltipInvalidPositionError} from './tooltip-errors';
3233import { Observable } from 'rxjs/Observable' ;
3334import { Subject } from 'rxjs/Subject' ;
3435import { Dir } from '../core/rtl/dir' ;
36+ import { PlatformModule , Platform } from '../core/platform/index' ;
3537import 'rxjs/add/operator/first' ;
3638import { ScrollDispatcher } from '../core/overlay/scroll/scroll-dispatcher' ;
3739import { Subscription } from 'rxjs/Subscription' ;
@@ -55,8 +57,6 @@ export const SCROLL_THROTTLE_MS = 20;
5557 host : {
5658 '(longpress)' : 'show()' ,
5759 '(touchend)' : 'hide(' + TOUCHEND_HIDE_DELAY + ')' ,
58- '(mouseenter)' : 'show()' ,
59- '(mouseleave)' : 'hide()' ,
6060 } ,
6161 exportAs : 'mdTooltip' ,
6262} )
@@ -129,12 +129,23 @@ export class MdTooltip implements OnInit, OnDestroy {
129129 get _matShowDelay ( ) { return this . showDelay ; }
130130 set _matShowDelay ( v ) { this . showDelay = v ; }
131131
132- constructor ( private _overlay : Overlay ,
133- private _scrollDispatcher : ScrollDispatcher ,
134- private _elementRef : ElementRef ,
135- private _viewContainerRef : ViewContainerRef ,
136- private _ngZone : NgZone ,
137- @Optional ( ) private _dir : Dir ) { }
132+ constructor (
133+ private _overlay : Overlay ,
134+ private _elementRef : ElementRef ,
135+ private _scrollDispatcher : ScrollDispatcher ,
136+ private _viewContainerRef : ViewContainerRef ,
137+ private _ngZone : NgZone ,
138+ private _renderer : Renderer ,
139+ private _platform : Platform ,
140+ @Optional ( ) private _dir : Dir ) {
141+
142+ // The mouse events shouldn't be bound on iOS devices, because
143+ // they can prevent the first tap from firing it's click event.
144+ if ( ! _platform . IOS ) {
145+ _renderer . listen ( _elementRef . nativeElement , 'mouseenter' , ( ) => this . show ( ) ) ;
146+ _renderer . listen ( _elementRef . nativeElement , 'mouseleave' , ( ) => this . hide ( ) ) ;
147+ }
148+ }
138149
139150 ngOnInit ( ) {
140151 // When a scroll on the page occurs, update the position in case this tooltip needs
@@ -437,7 +448,7 @@ export class TooltipComponent {
437448
438449
439450@NgModule ( {
440- imports : [ OverlayModule , CompatibilityModule ] ,
451+ imports : [ OverlayModule , CompatibilityModule , PlatformModule ] ,
441452 exports : [ MdTooltip , TooltipComponent , CompatibilityModule ] ,
442453 declarations : [ MdTooltip , TooltipComponent ] ,
443454 entryComponents : [ TooltipComponent ] ,
0 commit comments