Skip to content

Commit fc92bd7

Browse files
authored
Merge pull request #108 from MikhailRoot/master
fixed bug on cordova accessing template via $http on local file:// ,issues with .then().catch(), $templateCache fixes.
2 parents 4229997 + 8e225f2 commit fc92bd7

9 files changed

+50
-24
lines changed

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-notification",
3-
"version": "0.3.0",
3+
"version": "0.3.5",
44
"homepage": "https://github.com/alexcrack/angular-ui-notification",
55
"repository": {
66
"type": "git",
@@ -31,9 +31,9 @@
3131
"build"
3232
],
3333
"dependencies": {
34-
"angular": "~1.2.23"
34+
"angular": "^1.5.x"
3535
},
3636
"devDependencies": {
37-
"bootstrap": "~3.3.2"
37+
"bootstrap": "^3.3.x"
3838
}
3939
}

demo/angular-ui-notification.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/angular-ui-notification.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-ui-notification.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* angular-ui-notification - Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
33
* @author Alex_Crack
4-
* @version v0.2.0
4+
* @version v0.3.5
55
* @link https://github.com/alexcrack/angular-ui-notification
66
* @license MIT
77
*/

dist/angular-ui-notification.js

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* angular-ui-notification - Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
33
* @author Alex_Crack
4-
* @version v0.2.0
4+
* @version v0.3.5
55
* @link https://github.com/alexcrack/angular-ui-notification
66
* @license MIT
77
*/
@@ -52,15 +52,30 @@ angular.module('ui-notification').provider('Notification', function() {
5252
args.scope = args.scope ? args.scope : $rootScope;
5353
args.template = args.templateUrl ? args.templateUrl : options.templateUrl;
5454
args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
55-
args.type = t || options.type || '';
55+
args.type = t || args.type || options.type || '';
5656
args.positionY = args.positionY ? args.positionY : options.positionY;
5757
args.positionX = args.positionX ? args.positionX : options.positionX;
5858
args.replaceMessage = args.replaceMessage ? args.replaceMessage : options.replaceMessage;
5959
args.onClose = args.onClose ? args.onClose : options.onClose;
6060
args.closeOnClick = (args.closeOnClick !== null && args.closeOnClick !== undefined) ? args.closeOnClick : options.closeOnClick;
6161
args.container = args.container ? args.container : options.container;
62-
63-
$http.get(args.template,{cache: $templateCache}).success(function(template) {
62+
63+
var template=$templateCache.get(args.template);
64+
65+
if(template){
66+
processNotificationTemplate(template);
67+
}else{
68+
// load it via $http only if it isn't default template and template isn't exist in template cache
69+
// cache:true means cache it for later access.
70+
$http.get(args.template,{cache: true})
71+
.then(processNotificationTemplate)
72+
.catch(function(data){
73+
throw new Error('Template ('+args.template+') could not be loaded. ' + data);
74+
});
75+
}
76+
77+
78+
function processNotificationTemplate(template) {
6479

6580
var scope = args.scope.$new();
6681
scope.message = $sce.trustAsHtml(args.message);
@@ -193,9 +208,7 @@ angular.module('ui-notification').provider('Notification', function() {
193208

194209
deferred.resolve(scope);
195210

196-
}).error(function(data){
197-
throw new Error('Template ('+args.template+') could not be loaded. ' + data);
198-
});
211+
}
199212

200213
return deferred.promise;
201214
};

dist/angular-ui-notification.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-ui-notification.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)