@@ -57,7 +57,7 @@ var timerModule = angular.module('timer', [])
5757 $scope . startTime = null ;
5858 $scope . endTime = null ;
5959 $scope . timeoutId = null ;
60- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) >= 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
60+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) >= 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
6161 $scope . isRunning = false ;
6262
6363 $scope . $on ( 'timer-start' , function ( ) {
@@ -105,8 +105,8 @@ var timerModule = angular.module('timer', [])
105105 $scope . start = $element [ 0 ] . start = function ( ) {
106106 $scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
107107 $scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
108- if ( ! $scope . countdown ) {
109- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
108+ if ( ! angular . isNumber ( $scope . countdown ) ) {
109+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
110110 }
111111 resetTimeout ( ) ;
112112 tick ( ) ;
@@ -140,7 +140,7 @@ var timerModule = angular.module('timer', [])
140140 $scope . reset = $element [ 0 ] . reset = function ( ) {
141141 $scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
142142 $scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
143- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
143+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
144144 resetTimeout ( ) ;
145145 tick ( ) ;
146146 $scope . isRunning = false ;
0 commit comments