From d33e09c7af389f5140e8f0cb7c30c2634633d8df Mon Sep 17 00:00:00 2001 From: Sergey Lysenko Date: Fri, 19 May 2017 15:50:37 +0300 Subject: [PATCH] Replace $timeout with $interval for ability to test angular-notify with Protractor fix #41 issue --- angular-notify.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/angular-notify.js b/angular-notify.js index c60eb10..8b45d26 100755 --- a/angular-notify.js +++ b/angular-notify.js @@ -1,5 +1,5 @@ -angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile','$templateCache','$rootScope', - function($timeout,$http,$compile,$templateCache,$rootScope){ +angular.module('cgNotify', []).factory('notify',['$interval','$http','$compile','$templateCache','$rootScope', + function($interval,$http,$compile,$templateCache,$rootScope){ var startTop = 10; var verticalSpacing = 15; @@ -69,9 +69,9 @@ angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile',' messageElements.push(templateElement); if (scope.$position === 'center'){ - $timeout(function(){ + $interval(function(){ scope.$centerMargin = '-' + (templateElement[0].offsetWidth /2) + 'px'; - }); + },0,1); } scope.$close = function(){ @@ -97,14 +97,14 @@ angular.module('cgNotify', []).factory('notify',['$timeout','$http','$compile',' } }; - $timeout(function(){ + $interval(function(){ layoutMessages(); - }); + },0,1); if (args.duration > 0){ - $timeout(function(){ + $interval(function(){ scope.$close(); - },args.duration); + },args.duration,1); } }, function(data) {