|
1 | 1 | /*
|
2 | 2 | * angular-tooltips
|
3 |
| - * 1.0.9 |
| 3 | + * 1.0.10 |
4 | 4 | *
|
5 | 5 | * Angular.js tooltips module.
|
6 | 6 | * http://720kb.github.io/angular-tooltips
|
7 | 7 | *
|
8 | 8 | * MIT license
|
9 |
| - * Wed Apr 13 2016 |
| 9 | + * Sat Apr 30 2016 |
10 | 10 | */
|
11 | 11 | /*global angular,window*/
|
12 | 12 | (function withAngular(angular, window) {
|
|
238 | 238 | if ($attrs.tooltipTemplate &&
|
239 | 239 | $attrs.tooltipTemplateUrl) {
|
240 | 240 |
|
241 |
| - throw new Error('You can not define tooltip-template and tooltip-url together'); |
| 241 | + throw new Error('You can not define tooltip-template and tooltip-template-url together'); |
242 | 242 | }
|
243 | 243 |
|
244 | 244 | if (!($attrs.tooltipTemplateUrl || $attrs.tooltipTemplate) &&
|
|
288 | 288 | }
|
289 | 289 | }
|
290 | 290 | , onTooltipShow = function onTooltipShow(event) {
|
| 291 | + |
291 | 292 | tipElement.addClass('_hidden');
|
292 | 293 | if ($attrs.tooltipSmart) {
|
293 | 294 |
|
|
549 | 550 | , onTooltipTemplateChange = function onTooltipTemplateChange(newValue) {
|
550 | 551 |
|
551 | 552 | if (newValue) {
|
552 |
| - |
| 553 | + tooltipElement.removeClass('_force-hidden'); //see lines below, this forces to hide tooltip when is empty |
553 | 554 | tipTipElement.empty();
|
554 | 555 | tipTipElement.append(closeButtonElement);
|
555 | 556 | tipTipElement.append(newValue);
|
556 |
| - $timeout(function doLater() { |
| 557 | + $timeout(function doLaterShow() { |
557 | 558 |
|
558 | 559 | onTooltipShow();
|
559 | 560 | });
|
| 561 | + } else { |
| 562 | + //hide tooltip because is empty |
| 563 | + tipTipElement.empty(); |
| 564 | + tooltipElement.addClass('_force-hidden'); //force to be hidden if empty |
560 | 565 | }
|
561 | 566 | }
|
562 | 567 | , onTooltipTemplateUrlChange = function onTooltipTemplateUrlChange(newValue) {
|
|
568 | 573 | if (response &&
|
569 | 574 | response.data) {
|
570 | 575 |
|
| 576 | + tooltipElement.removeClass('_force-hidden'); //see lines below, this forces to hide tooltip when is empty |
571 | 577 | tipTipElement.empty();
|
572 | 578 | tipTipElement.append(closeButtonElement);
|
573 | 579 | tipTipElement.append($compile(response.data)(scope));
|
|
577 | 583 | });
|
578 | 584 | }
|
579 | 585 | });
|
| 586 | + } else { |
| 587 | + //hide tooltip because is empty |
| 588 | + tipTipElement.empty(); |
| 589 | + tooltipElement.addClass('_force-hidden'); //force to be hidden if empty |
580 | 590 | }
|
581 | 591 | }
|
582 | 592 | , onTooltipSideChange = function onTooltipSideChange(newValue) {
|
|
0 commit comments