Skip to content

Commit

Permalink
added: onClose function
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrombafonso committed Oct 9, 2014
1 parent 2f89d45 commit 280652c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion angular-notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile','
args.position = args.position ? args.position : position;
args.container = args.container ? args.container : container;
args.classes = args.classes ? args.classes : '';
args.onClose = args.onClose ? args.onClose : function () {return;};

var scope = args.scope ? args.scope.$new() : $rootScope.$new();
scope.$message = args.message;
scope.$classes = args.classes;
scope.$messageTemplate = args.messageTemplate;
scope.$onClose = args.onClose;

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

Expand Down Expand Up @@ -66,6 +68,7 @@ angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile','
scope.$close = function(){
templateElement.css('opacity',0).attr('data-closing','true');
layoutMessages();
scope.$onClose();
};

var layoutMessages = function(){
Expand Down Expand Up @@ -101,7 +104,7 @@ angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile','
});

var retVal = {};

retVal.close = function(){
if (scope.$close){
scope.$close();
Expand Down

0 comments on commit 280652c

Please sign in to comment.