Skip to content

Commit

Permalink
Fixes #12 added timeout so the message is sent on the next digest cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
JanStevens committed May 25, 2014
1 parent 3830399 commit 11aea0d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/growlDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ angular.module("angular-growl").directive("growl", ["$rootScope", "$sce",
$scope.inlineMessage = $scope.inline || growl.inlineMessages();

function addMessage(message) {
message.text = $sce.trustAsHtml(message.text);
$scope.messages.push(message);
$timeout(function() {
message.text = $sce.trustAsHtml(message.text);
$scope.messages.push(message);

if (message.ttl && message.ttl !== -1) {
$timeout(function() {
$scope.deleteMessage(message);
}, message.ttl);
}
if (message.ttl && message.ttl !== -1) {
$timeout(function() {
$scope.deleteMessage(message);
}, message.ttl);
}
}, true);
}

$rootScope.$on("growlMessage", function(event, message) {
Expand Down

0 comments on commit 11aea0d

Please sign in to comment.