Skip to content

Commit

Permalink
Merge pull request marcorinck#31 from Anaphase/master
Browse files Browse the repository at this point in the history
Adds growl template to $templateCache only if it doesn't already exist
  • Loading branch information
Jan Stevens committed Aug 10, 2014
2 parents bf5f9d7 + 3cd1b86 commit a1dcca4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion build/angular-growl.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ angular.module('angular-growl').run([
'$templateCache',
function ($templateCache) {
'use strict';
$templateCache.put('templates/growl/growl.html', '<div class="growl-container" ng-class="wrapperClasses()">' + '<div class="growl-item alert" ng-repeat="message in messages" ng-class="alertClasses(message)">' + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="deleteMessage(message)" ng-show="!message.disableCloseButton">&times;</button>' + '<h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>' + '<div class="growl-message" ng-bind-html="message.text"></div>' + '</div>' + '</div>');
if ($templateCache.get('templates/growl/growl.html') === undefined) {
$templateCache.put('templates/growl/growl.html', '<div class="growl-container" ng-class="wrapperClasses()">' + '<div class="growl-item alert" ng-repeat="message in messages" ng-class="alertClasses(message)">' + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="deleteMessage(message)" ng-show="!message.disableCloseButton">&times;</button>' + '<h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>' + '<div class="growl-message" ng-bind-html="message.text"></div>' + '</div>' + '</div>');
}
}
]);
angular.module('angular-growl').provider('growl', function () {
Expand Down
2 changes: 1 addition & 1 deletion build/angular-growl.min.js

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

20 changes: 11 additions & 9 deletions src/growlDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ angular.module("angular-growl").directive("growl", ["$rootScope", "$sce",

angular.module("angular-growl").run(['$templateCache', function($templateCache) {
"use strict";
$templateCache.put("templates/growl/growl.html",
'<div class="growl-container" ng-class="wrapperClasses()">' +
'<div class="growl-item alert" ng-repeat="message in messages" ng-class="alertClasses(message)">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="deleteMessage(message)" ng-show="!message.disableCloseButton">&times;</button>' +
'<h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>' +
'<div class="growl-message" ng-bind-html="message.text"></div>' +
'</div>' +
'</div>'
);
if ($templateCache.get('templates/growl/growl.html') === undefined) {
$templateCache.put("templates/growl/growl.html",
'<div class="growl-container" ng-class="wrapperClasses()">' +
'<div class="growl-item alert" ng-repeat="message in messages" ng-class="alertClasses(message)">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="deleteMessage(message)" ng-show="!message.disableCloseButton">&times;</button>' +
'<h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>' +
'<div class="growl-message" ng-bind-html="message.text"></div>' +
'</div>' +
'</div>'
);
}
}]);

0 comments on commit a1dcca4

Please sign in to comment.