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

refactor(tooltip): remove observers #1817

Merged

Conversation

chrisirhc
Copy link
Contributor

Part of #1600. Lazily evaluate values only when they're needed.

Breaking change:

  • Set up triggers only once, so the triggers can't be changed later

It's possible to remove the observers for title and content and lazily evaluate them as well. That part can also be abstracted into a controller method.

@Foxandxss
Copy link
Contributor

Does the observers hurt that much? I agree that they are not likely to change though.

@chrisirhc
Copy link
Contributor Author

@Foxandxss , they don't hurt that much. However, they add overhead to the page even though the tooltips aren't visible.
I think @pkozlowski-opensource wants to further simplify the tooltips.

@pkozlowski-opensource
Copy link
Member

@Foxandxss yes, the main goal for removing observers is to simplify this directive / service, both in terms of LOC and conceptual overhead. You simply don't need to think "what happens if this value changes, what do I need to update, what do I need to clean-up" for cases where change doesn't make sense from the usage point of view.

@Foxandxss
Copy link
Contributor

Good, I am always on the learning perspective :P

There's no need for an observer here because these values are only used
on initialization of the tooltip.
This change fixes the usage of the tooltip directive with AngularJS
1.3.1 when no trigger attribute is used.

BREAKING CHANGE: tooltip/popover trigger is no longer a watched
attribute.
This affects both popovers and tooltips. The triggers are now set up
once and can no longer be changed after initialization.
@chrisirhc chrisirhc force-pushed the feature/tooltip-remove-observers branch from bb329d2 to a65bea9 Compare November 2, 2014 05:17
@chrisirhc chrisirhc merged commit a65bea9 into angular-ui:master Nov 2, 2014
@chrisirhc chrisirhc deleted the feature/tooltip-remove-observers branch November 2, 2014 05:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants