Skip to content

MdTooltip: navigating to a new page while the tooltip is still visible throws an error #1809

@rolandjitsu

Description

@rolandjitsu

Bug, feature request, or proposal:

Bug

What is the expected behavior?

It should not throw an error.

What is the current behavior?

If you navigate away from a page (via routing) where a tooltip is currently being displayed, it throws a Uncaught TypeError: Cannot read property 'dispose' of null.
Stacktrace:

Uncaught TypeError: Cannot read property 'dispose' of null
    at MdTooltip._disposeTooltip (http://localhost:3000/node_modules/@angular/material/material.umd.js:8573:25)
    at SafeSubscriber.eval [as _next] (http://localhost:3000/node_modules/@angular/material/material.umd.js:8559:19)
    at SafeSubscriber.__tryOrUnsub (http://localhost:3000/node_modules/rxjs/Subscriber.js:223:16)
    at SafeSubscriber.next (http://localhost:3000/node_modules/rxjs/Subscriber.js:172:22)
    at Subscriber._next (http://localhost:3000/node_modules/rxjs/Subscriber.js:125:26)
    at Subscriber.next (http://localhost:3000/node_modules/rxjs/Subscriber.js:89:18)
    at Subject.next (http://localhost:3000/node_modules/rxjs/Subject.js:55:25)
    at TooltipComponent._afterVisibilityAnimation (http://localhost:3000/node_modules/@angular/material/material.umd.js:8686:26)
    at _View_TooltipComponent0._handle_state_0_0 (/MdTooltipModule/TooltipComponent/component.ngfactory.js:62:30)
    at Array.forEach (native)
MdTooltip._disposeTooltip @ tooltip.js:115
(anonymous) @ tooltip.js:101
SafeSubscriber.__tryOrUnsub @ Subscriber.ts:238
SafeSubscriber.next @ Subscriber.ts:190
Subscriber._next @ Subscriber.ts:135
Subscriber.next @ Subscriber.ts:95
Subject.next @ Subject.ts:61
TooltipComponent._afterVisibilityAnimation @ tooltip.js:228
_View_TooltipComponent0._handle_state_0_0 @ component.ngfactory.js:62
AnimationSequencePlayer._onFinish @ core.umd.js:7862
AnimationSequencePlayer._onNext @ core.umd.js:7845
WebAnimationsPlayer._onFinish @ platform-browser.umd.js:192

What are the steps to reproduce?

Have a simple page with a tooltip and a second page to navigate to via the angular router. Show the tooltip and navigate away to the second page before the tooltip is removed (within the 1.5s window).

Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

2.0.0-alpha.10

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions