Skip to content

Commit

Permalink
Fixes JanStevens#81 replacing by and making notifications being testa…
Browse files Browse the repository at this point in the history
…ble by protractor
  • Loading branch information
gastonelhordoy committed Apr 27, 2015
1 parent ee0fcc0 commit 104786c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/growlDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ angular.module("angular-growl").directive("growl", [
inline: '=',
limitMessages: '='
},
controller: ['$scope', '$timeout', 'growl', 'growlMessages',
function ($scope, $timeout, growl, growlMessages) {
controller: ['$scope', '$interval', 'growl', 'growlMessages',
function ($scope, $interval, growl, growlMessages) {
$scope.referenceId = $scope.reference || 0;

growlMessages.initDirective($scope.referenceId, $scope.limitMessages);
Expand All @@ -30,7 +30,7 @@ angular.module("angular-growl").directive("growl", [
$scope.stopTimeoutClose = function (message) {
if (!message.clickToClose) {
angular.forEach(message.promises, function (promise) {
$timeout.cancel(promise);
$interval.cancel(promise);
});
if (message.close) {
growlMessages.deleteMessage(message);
Expand Down
10 changes: 5 additions & 5 deletions src/growlMessageService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
angular.module("angular-growl").service("growlMessages", ['$sce', '$timeout', function ($sce, $timeout) {
angular.module("angular-growl").service("growlMessages", ['$sce', '$interval', function ($sce, $interval) {
"use strict";

this.directives = {};
Expand Down Expand Up @@ -102,7 +102,7 @@ angular.module("angular-growl").service("growlMessages", ['$sce', '$timeout', fu
message.countdownFunction = function () {
if (message.countdown > 1) {
message.countdown--;
message.promises.push($timeout(message.countdownFunction, 1000));
message.promises.push($interval(message.countdownFunction, 1000, 1));
} else {
message.countdown--;
}
Expand Down Expand Up @@ -130,10 +130,10 @@ angular.module("angular-growl").service("growlMessages", ['$sce', '$timeout', fu

if (message.ttl && message.ttl !== -1) {
//adds message timeout to promises and starts messages countdown function.
message.promises.push($timeout(angular.bind(this, function () {
message.promises.push($interval(angular.bind(this, function () {
this.deleteMessage(message);
}), message.ttl));
message.promises.push($timeout(message.countdownFunction, 1000));
}), message.ttl, 1));
message.promises.push($interval(message.countdownFunction, 1000, 1));
}

return message;
Expand Down

0 comments on commit 104786c

Please sign in to comment.