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

Remove a need for a child scope in tooltips / popovers #1269

Closed
Sinetheta opened this issue Nov 18, 2013 · 5 comments
Closed

Remove a need for a child scope in tooltips / popovers #1269

Sinetheta opened this issue Nov 18, 2013 · 5 comments

Comments

@Sinetheta
Copy link

I've created a SO question regarding this behaviour, but I think it qualifies as an issue.

When using tooltip from the Angular UI on an element which is also using directive that asks for an isolated scope, eg:

.directive('smile', function() {
  return {
    scope: {},
    template: ':)'
  };
});

I get the following error in Firefox but not in Chrome:

Error: Multiple directives [smile, tooltip] asking for isolated scope on: <a class="ng-isolate-scope ng-scope" href="#" tooltip="Tooltip" tooltip-placement="bottom" smile="">

Which is odd because I wouldn't expect a tooltip to ask for an isolated scope. It's my understanding this line in the source says that the directive does not ask for an isolated scope, and that only the popup which gets injected at the bottom of the page does.

Isn't this bad? Why is this error only showing up in Firefox?

@pkozlowski-opensource
Copy link
Member

@Sinetheta as answered on SO it is really how AngularJS works at the moment - that is, child scopes are treated the same way as isolated scopes. There is not much we can do about it, the only work-arround you can use for now is to put a tooltip on a separate DOM element. What we could do, though, is to remove a need for a child scope in a tooltip which is technically possible. I'm renaming this issue to reflect this.

Having said the above, removing a need for an isolated scope is not a trivial task so this won't happen overnight.

@Sinetheta
Copy link
Author

Thanks @pkozlowski-opensource, it's kind of sad that Angular works that way, and even more bizarre that it's inconsistent between browsers.

@pkozlowski-opensource
Copy link
Member

@Sinetheta For the inconsistency between browsers - it should be taken with the AngularJS team itself. Getting scoping right is not a trivial problem and I'm not surprised that it takes time to settle this design / implementation in AngularJS. What we can do in this project is to remove a need for the isolated scope in this project and this is why I've changed issue name.

@pkozlowski-opensource
Copy link
Member

Another instance of the same issue: #1497

@chrisirhc
Copy link
Contributor

The treatment of isolate scopes has changed in AngularJS 1.2 (see angular/angular.js@909cabd) , we can now reconsider removing the child scope.

chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this issue Nov 2, 2014
tt_ scope variables are now in the ttScope which is specific to each
tooltip directive (multiple tooltip directives can now run on the same
element).

This allows tooltips to be used alongside any directive that may or
may not require different scope types.

Closes angular-ui#1269
Fixes angular-ui#2320
Fixes angular-ui#2203
@chrisirhc chrisirhc self-assigned this Nov 2, 2014
chrisirhc added a commit to chrisirhc/angular-ui-bootstrap that referenced this issue Nov 2, 2014
tt_ scope variables are now in the ttScope which is specific to each
tooltip directive (multiple tooltip directives can now run on the same
element).

This allows tooltips to be used alongside any directive that may or
may not require different scope types.

Closes angular-ui#1269
Fixes angular-ui#2320
Fixes angular-ui#2203
OronNadiv pushed a commit to lanetix/bootstrap that referenced this issue Nov 18, 2014
tt_ scope variables are now in the ttScope which is specific to each
tooltip directive (multiple tooltip directives can now run on the same
element).

This allows tooltips to be used alongside any directive that may or
may not require different scope types.

Closes angular-ui#1269
Fixes angular-ui#2320
Fixes angular-ui#2203
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.