Components: MdTooltip doesn't work with pipe

Created on 19 Aug 2016  路  9Comments  路  Source: angular/components

Bug, feature request, or proposal:

Bug

What is the expected behavior?

MdTooltip to work fine with pipe

What is the current behavior?

Tootlip doesn't work using the following expression:
[md-tooltip]="activity.created_at | amTimeAgo"

[browser_adapter.js:85 RangeError: Maximum call stack size exceeded
    at defaultParsingFlags (moment.js:80)
    at getParsingFlags (moment.js:100)
    at configFromISO (moment.js:1958)
    at configFromString (moment.js:2012)
    at configFromInput (moment.js:2375)
    at prepareConfig (moment.js:2358)
    at createFromConfig (moment.js:2325)
    at createLocalOrUTC (moment.js:2412)
    at local__createLocal (moment.js:2416)
    at utils_hooks__hooks (moment.js:16)
    at TimeAgoPipe.transform (TimeAgoPipe.ts:37)]

What are the steps to reproduce?

using angular2-moment with MdTooltip:
[md-tooltip]="activity.created_at | amTimeAgo"

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

Angular 2 Rc.5 + Webpack = Angular 2 Material a7-2

P3

Most helpful comment

@m0t0r It is possible.
I also tried md-tooltip="{{activity.created_at | amTimeAgo}}" and got the same.

All 9 comments

@theunreal you are trying to use pipe on a binding, not on interpolation. I am not sure that is possible.

@m0t0r It is possible.
I also tried md-tooltip="{{activity.created_at | amTimeAgo}}" and got the same.

@theunreal can you create an example ? Look at this plunker. The pipe applied to binding is not working, you likely have error not from MdTooltip but rather from amTimeAgo pipe

@m0t0r your hello needs to be a variable and the text attributes need to have brackets [text], it's an expression as you can see in my code. activity.created_at is a variable, not a free text string.

If you will update the following in your app, you will see your text in a uppercase letters.

@theunreal yes, sorry, my bad. It works now, interesting..

Interestingly, it seems to be possible to use pipes with moustache tags now, like this:
md-tooltip="{{value | pipe}}"
however, using the following syntax still results in the maximum call stack size exceeded error:
[md-tooltip]="value | pipe"

I just added a workaround in #1157

The issue here was due to a detectChanges call in the tooltip positioning. This no longer exists in the logic and this issue is fixed.

See working example: http://plnkr.co/edit/5gkBSK4zgCjSRSTDGA15?p=preview

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dzrust picture dzrust  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments

Miiekeee picture Miiekeee  路  3Comments