diff --git a/app/js/timer.js b/app/js/timer.js index ced1501..10cbf03 100644 --- a/app/js/timer.js +++ b/app/js/timer.js @@ -64,6 +64,18 @@ var timerModule = angular.module('timer', []) } } + $scope.$watch('startTimeAttr', function(newValue, oldValue) { + if (newValue !== oldValue && $scope.isRunning) { + $scope.start(); + } + }); + + $scope.$watch('endTimeAttr', function(newValue, oldValue) { + if (newValue !== oldValue && $scope.isRunning) { + $scope.start(); + } + }); + $scope.start = $element[0].start = function () { $scope.startTime = $scope.startTimeAttr ? new Date($scope.startTimeAttr) : new Date(); $scope.endTime = $scope.endTimeAttr ? new Date($scope.endTimeAttr) : null;