Skip to content

Commit

Permalink
tooltip template url cache fix
Browse files Browse the repository at this point in the history
  • Loading branch information
45kb committed Aug 4, 2016
1 parent dab10a6 commit e9751f7
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tooltips",
"version": "1.1.4",
"version": "1.1.5",
"description": "Angular.js tooltips module.",
"authors": [
"Filippo Oretti <[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-tooltips.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions dist/angular-tooltips.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* angular-tooltips
* 1.1.4
* 1.1.5
*
* Angular.js tooltips module.
* http://720kb.github.io/angular-tooltips
*
* MIT license
* Mon Jun 06 2016
* Thu Aug 04 2016
*/
/*global angular,window*/
(function withAngular(angular, window) {
Expand Down Expand Up @@ -247,7 +247,7 @@
}
};
}
, tooltipDirective = /*@ngInject*/ ["$log", "$http", "$compile", "$timeout", "$controller", "$injector", "tooltipsConf", "$templateCache", function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf) {
, tooltipDirective = /*@ngInject*/ ['$log', '$http', '$compile', '$timeout', '$controller', '$injector', 'tooltipsConf', '$templateCache', function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf, $templateCache) {

var linkingFunction = function linkingFunction($scope, $element, $attrs, $controllerDirective, $transcludeFunc) {

Expand Down Expand Up @@ -609,14 +609,21 @@
var template = $templateCache.get($attrs.tooltipTemplateUrl);

if (typeof template !== 'undefined') {

tooltipElement.removeClass('_force-hidden'); //see lines below, this forces to hide tooltip when is empty
tipTipElement.empty();
tipTipElement.append(closeButtonElement);
tipTipElement.append($compile(response.data)(scope));
$timeout(function doLater() {
$http.get(newValue).then(function onResponse(response) {

This comment has been minimized.

Copy link
@45kb

45kb Aug 4, 2016

Author Member

@kmoroder I had to add the promise again here, because response was undefined, is it ok ?

This comment has been minimized.

Copy link
@kmoroder

kmoroder Aug 4, 2016

Contributor

Makes sense!


if (response &&
response.data) {

onTooltipShow();
tipTipElement.append($compile(response.data)(scope));
$timeout(function doLater() {

onTooltipShow();
});
}
});
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-tooltips.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/angular-tooltips.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/angular-tooltips.min.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions lib/angular-tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
}
};
}
, tooltipDirective = /*@ngInject*/ ["$log", "$http", "$compile", "$timeout", "$controller", "$injector", "tooltipsConf", "$templateCache", function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf) {
, tooltipDirective = /*@ngInject*/ ['$log', '$http', '$compile', '$timeout', '$controller', '$injector', 'tooltipsConf', '$templateCache', function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf, $templateCache) {

var linkingFunction = function linkingFunction($scope, $element, $attrs, $controllerDirective, $transcludeFunc) {

Expand Down Expand Up @@ -603,10 +603,17 @@
tooltipElement.removeClass('_force-hidden'); //see lines below, this forces to hide tooltip when is empty
tipTipElement.empty();
tipTipElement.append(closeButtonElement);
tipTipElement.append($compile(response.data)(scope));
$timeout(function doLater() {
$http.get(newValue).then(function onResponse(response) {

onTooltipShow();
if (response &&
response.data) {

tipTipElement.append($compile(response.data)(scope));
$timeout(function doLater() {

onTooltipShow();
});
}
});
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tooltips",
"version": "1.1.4",
"version": "1.1.5",
"description": "Angular.js tooltips module.",
"homepage": "http://720kb.github.io/angular-tooltips",
"main": "index.js",
Expand Down

0 comments on commit e9751f7

Please sign in to comment.