Skip to content

Commit

Permalink
Merge pull request #108 from MikhailRoot/master
Browse files Browse the repository at this point in the history
fixed bug on cordova accessing template via $http on local file:// ,issues with .then().catch(), $templateCache fixes.
  • Loading branch information
alexcrack authored Jan 7, 2017
2 parents 4229997 + 8e225f2 commit fc92bd7
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 24 deletions.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ui-notification",
"version": "0.3.0",
"version": "0.3.5",
"homepage": "https://github.com/alexcrack/angular-ui-notification",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,9 +31,9 @@
"build"
],
"dependencies": {
"angular": "~1.2.23"
"angular": "^1.5.x"
},
"devDependencies": {
"bootstrap": "~3.3.2"
"bootstrap": "^3.3.x"
}
}
2 changes: 1 addition & 1 deletion demo/angular-ui-notification.min.css

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

4 changes: 2 additions & 2 deletions demo/angular-ui-notification.min.js

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

2 changes: 1 addition & 1 deletion dist/angular-ui-notification.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* angular-ui-notification - Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
* @author Alex_Crack
* @version v0.2.0
* @version v0.3.5
* @link https://github.com/alexcrack/angular-ui-notification
* @license MIT
*/
Expand Down
27 changes: 20 additions & 7 deletions dist/angular-ui-notification.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* angular-ui-notification - Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
* @author Alex_Crack
* @version v0.2.0
* @version v0.3.5
* @link https://github.com/alexcrack/angular-ui-notification
* @license MIT
*/
Expand Down Expand Up @@ -52,15 +52,30 @@ angular.module('ui-notification').provider('Notification', function() {
args.scope = args.scope ? args.scope : $rootScope;
args.template = args.templateUrl ? args.templateUrl : options.templateUrl;
args.delay = !angular.isUndefined(args.delay) ? args.delay : delay;
args.type = t || options.type || '';
args.type = t || args.type || options.type || '';
args.positionY = args.positionY ? args.positionY : options.positionY;
args.positionX = args.positionX ? args.positionX : options.positionX;
args.replaceMessage = args.replaceMessage ? args.replaceMessage : options.replaceMessage;
args.onClose = args.onClose ? args.onClose : options.onClose;
args.closeOnClick = (args.closeOnClick !== null && args.closeOnClick !== undefined) ? args.closeOnClick : options.closeOnClick;
args.container = args.container ? args.container : options.container;

$http.get(args.template,{cache: $templateCache}).success(function(template) {

var template=$templateCache.get(args.template);

if(template){
processNotificationTemplate(template);
}else{
// load it via $http only if it isn't default template and template isn't exist in template cache
// cache:true means cache it for later access.
$http.get(args.template,{cache: true})
.then(processNotificationTemplate)
.catch(function(data){
throw new Error('Template ('+args.template+') could not be loaded. ' + data);
});
}


function processNotificationTemplate(template) {

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

deferred.resolve(scope);

}).error(function(data){
throw new Error('Template ('+args.template+') could not be loaded. ' + data);
});
}

return deferred.promise;
};
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-ui-notification.min.css

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

4 changes: 2 additions & 2 deletions dist/angular-ui-notification.min.js

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

Loading

0 comments on commit fc92bd7

Please sign in to comment.