Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: 720kb/angular-tooltips
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: slavafomin/angular-tooltips
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Apr 19, 2016

  1. Angular Template cache is now supported.

    Slava Fomin II committed Apr 19, 2016
    Copy the full SHA
    9d857d2 View commit details
Showing with 25 additions and 15 deletions.
  1. +1 −0 .gitignore
  2. +24 −15 lib/angular-tooltips.js
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
@@ -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) {

@@ -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) {