From 0229d84493c8e47a8e98ab430ad67124327bd92f Mon Sep 17 00:00:00 2001 From: Joe Bordes Date: Fri, 26 Jun 2015 23:47:04 +0200 Subject: [PATCH 1/2] fix(SetTime) set time for stopped timer --- dist/angular-timer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/angular-timer.js b/dist/angular-timer.js index 04d57e2..d462bc6 100644 --- a/dist/angular-timer.js +++ b/dist/angular-timer.js @@ -98,8 +98,15 @@ var timerModule = angular.module('timer', []) } $scope.$watch('startTimeAttr', function(newValue, oldValue) { - if (newValue !== oldValue && $scope.isRunning) { + if (newValue !== oldValue) { + if ($scope.isRunning) { $scope.start(); + } else { + $scope.startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : moment(); + $scope.endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null; + tick(); + $scope.clear(); + } } }); From 34cccc3558912e9519fd6668dda9440f4d827a64 Mon Sep 17 00:00:00 2001 From: Joe Bordes Date: Sat, 27 Jun 2015 11:50:48 +0200 Subject: [PATCH 2/2] fix(Set Timer) set timer from angularjs binding after initialization --- app/js/_timer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/js/_timer.js b/app/js/_timer.js index 79c1a4b..e64c61c 100644 --- a/app/js/_timer.js +++ b/app/js/_timer.js @@ -91,8 +91,15 @@ var timerModule = angular.module('timer', []) } $scope.$watch('startTimeAttr', function(newValue, oldValue) { - if (newValue !== oldValue && $scope.isRunning) { + if (newValue !== oldValue) { + if ($scope.isRunning) { $scope.start(); + } else { + $scope.startTime = $scope.startTimeAttr ? moment($scope.startTimeAttr) : moment(); + $scope.endTime = $scope.endTimeAttr ? moment($scope.endTimeAttr) : null; + tick(); + $scope.clear(); + } } });