Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.idea/
node_modules/
bower_components/
npm-debug.log
39 changes: 24 additions & 15 deletions lib/angular-tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
}
};
}
, tooltipDirective = /*@ngInject*/ function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf) {
, tooltipDirective = /*@ngInject*/ function tooltipDirective($log, $http, $compile, $timeout, $controller, $injector, tooltipsConf, $templateCache) {

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

Expand Down Expand Up @@ -549,25 +549,34 @@
});
}
}
, onTooltipTemplateUrlChange = function onTooltipTemplateUrlChange(newValue) {
, onTooltipTemplateUrlChange = function onTooltipTemplateUrlChange(templateUrl) {

if (newValue) {
if (!templateUrl) {
return;
}

$http.get(newValue).then(function onResponse(response) {
// Trying to load template from the template cache first.
var template = $templateCache.get(templateUrl);

if (response &&
response.data) {
if ('undefined' === typeof template) {
$http
.get(templateUrl)
.then(function onResponse(response) {
if (response && response.data) {
template = response.data;
$templateCache.put(templateUrl, template);
}
})
;
}

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

onTooltipShow();
});
}
});
}
}
, onTooltipSideChange = function onTooltipSideChange(newValue) {

Expand Down