Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

dynamic toolip text - tooltip not removed when you clear the value while tooltip is visible and vice versa #559

Closed
fxck opened this issue Jun 25, 2013 · 4 comments

Comments

@fxck
Copy link

fxck commented Jun 25, 2013

Let's say I have an input

<input ng-model="url" tooltip="{{ form.url.$valid | returnOnlyWhenFalse }}" name="url" type="url" />

now if I focus the input and start typing, ideally I would like the tooltip to appear when $valid becames false which is not going to happen unless I mouseleave and mouseenter again..

and the problem is the other way around as well, if I mousenter and $valid is false, tooltip's gonna be visible, if $valid becames true, tooltip's not gonna dissappear, it's just gonna get its text removed

you can see this behaviour here http://angular-ui.github.io/bootstrap/#/tooltip focus the dynamic input and the mouseover the dynamic tooltip

any idea how can I "hotfix" this?

@fxck
Copy link
Author

fxck commented Jun 25, 2013

hm well the hot fix would be to change

if ( ! scope.tt_content ) {} to only still show the tooltip, but hidden and then something like this

          attrs.$observe( type, function ( val ) {
            if (!val) {
              hide();
            }

            tooltip.css({opacity: 1});

            scope.tt_content = val;
          });

it's clunky but it works, hopefully this could be configurable later

@fxck
Copy link
Author

fxck commented Jun 27, 2013

the problem is with positioning though, it doesn't get it right..

@pkozlowski-opensource
Copy link
Member

Duplicate of #590

We need to add ability to control tooltips programatically

@geersch
Copy link

geersch commented Jul 16, 2014

For now I just use the following workaround:

attrs.$observe(type, function (val) {
    scope.tt_content = val;
    setTimeout(function() {
        if (!val) {
            hideTooltipBind();
        } else {
            showTooltipBind();
        }
    }, 1);
});

Not ideal and sadly the setTimeout(...) is to circumvent an issue with positioning the next time the tooltip is shown. It doesn't center correctly if you call showTooltipBind() directly.

codedogfish pushed a commit to codedogfish/angular-ui-bootstrap that referenced this issue Sep 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants