@@ -15,6 +15,7 @@ import {
15
15
NgZone ,
16
16
Optional ,
17
17
OnDestroy ,
18
+ Renderer ,
18
19
OnInit ,
19
20
ChangeDetectorRef
20
21
} from '@angular/core' ;
@@ -32,6 +33,7 @@ import {MdTooltipInvalidPositionError} from './tooltip-errors';
32
33
import { Observable } from 'rxjs/Observable' ;
33
34
import { Subject } from 'rxjs/Subject' ;
34
35
import { Dir } from '../core/rtl/dir' ;
36
+ import { PlatformModule , Platform } from '../core/platform/index' ;
35
37
import 'rxjs/add/operator/first' ;
36
38
import { ScrollDispatcher } from '../core/overlay/scroll/scroll-dispatcher' ;
37
39
import { Subscription } from 'rxjs/Subscription' ;
@@ -55,8 +57,6 @@ export const SCROLL_THROTTLE_MS = 20;
55
57
host : {
56
58
'(longpress)' : 'show()' ,
57
59
'(touchend)' : 'hide(' + TOUCHEND_HIDE_DELAY + ')' ,
58
- '(mouseenter)' : 'show()' ,
59
- '(mouseleave)' : 'hide()' ,
60
60
} ,
61
61
exportAs : 'mdTooltip' ,
62
62
} )
@@ -129,12 +129,23 @@ export class MdTooltip implements OnInit, OnDestroy {
129
129
get _matShowDelay ( ) { return this . showDelay ; }
130
130
set _matShowDelay ( v ) { this . showDelay = v ; }
131
131
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
+ }
138
149
139
150
ngOnInit ( ) {
140
151
// When a scroll on the page occurs, update the position in case this tooltip needs
@@ -437,7 +448,7 @@ export class TooltipComponent {
437
448
438
449
439
450
@NgModule ( {
440
- imports : [ OverlayModule , CompatibilityModule ] ,
451
+ imports : [ OverlayModule , CompatibilityModule , PlatformModule ] ,
441
452
exports : [ MdTooltip , TooltipComponent , CompatibilityModule ] ,
442
453
declarations : [ MdTooltip , TooltipComponent ] ,
443
454
entryComponents : [ TooltipComponent ] ,
0 commit comments