1
1
/**
2
- * angular-timer - v1.3.3 - 2015-08-17 4:25 PM
2
+ * angular-timer - v1.3.3 - 2015-11-30 10:57 AM
3
3
* https://github.com/siddii/angular-timer
4
4
*
5
5
* Copyright (c) 2015 Siddique Hameed
@@ -19,19 +19,19 @@ var timerModule = angular.module('timer', [])
19
19
autoStart : '&autoStart' ,
20
20
language : '@?' ,
21
21
fallback : '@?' ,
22
- maxTimeUnit : '=? ' ,
22
+ maxTimeUnit : '=' ,
23
23
seconds : '=?' ,
24
24
minutes : '=?' ,
25
25
hours : '=?' ,
26
26
days : '=?' ,
27
27
months : '=?' ,
28
- years : '=?' ,
28
+ years : '=?' ,
29
29
secondsS : '=?' ,
30
30
minutesS : '=?' ,
31
31
hoursS : '=?' ,
32
32
daysS : '=?' ,
33
33
monthsS : '=?' ,
34
- yearsS : '=?'
34
+ yearsS : '=?'
35
35
} ,
36
36
controller : [ '$scope' , '$element' , '$attrs' , '$timeout' , 'I18nService' , '$interpolate' , 'progressBarService' , function ( $scope , $element , $attrs , $timeout , I18nService , $interpolate , progressBarService ) {
37
37
@@ -76,7 +76,7 @@ var timerModule = angular.module('timer', [])
76
76
$scope . startTime = null ;
77
77
$scope . endTime = null ;
78
78
$scope . timeoutId = null ;
79
- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) >= 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
79
+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) >= 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
80
80
$scope . isRunning = false ;
81
81
82
82
$scope . $on ( 'timer-start' , function ( ) {
@@ -124,8 +124,8 @@ var timerModule = angular.module('timer', [])
124
124
$scope . start = $element [ 0 ] . start = function ( ) {
125
125
$scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
126
126
$scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
127
- if ( ! $scope . countdown ) {
128
- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
127
+ if ( ! angular . isNumber ( $scope . countdown ) ) {
128
+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
129
129
}
130
130
resetTimeout ( ) ;
131
131
tick ( ) ;
@@ -159,7 +159,7 @@ var timerModule = angular.module('timer', [])
159
159
$scope . reset = $element [ 0 ] . reset = function ( ) {
160
160
$scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
161
161
$scope . endTime = $scope . endTimeAttr ? moment ( $scope . endTimeAttr ) : null ;
162
- $scope . countdown = $scope . countdownattr && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
162
+ $scope . countdown = angular . isNumber ( $scope . countdownattr ) && parseInt ( $scope . countdownattr , 10 ) > 0 ? parseInt ( $scope . countdownattr , 10 ) : undefined ;
163
163
resetTimeout ( ) ;
164
164
tick ( ) ;
165
165
$scope . isRunning = false ;
@@ -317,7 +317,7 @@ var timerModule = angular.module('timer', [])
317
317
$scope . $digest ( ) ;
318
318
} , $scope . interval - adjustment ) ;
319
319
320
- $scope . $emit ( 'timer-tick' , { timeoutId : $scope . timeoutId , millis : $scope . millis } ) ;
320
+ $scope . $emit ( 'timer-tick' , { timeoutId : $scope . timeoutId , millis : $scope . millis , timerElement : $element [ 0 ] } ) ;
321
321
322
322
if ( $scope . countdown > 0 ) {
323
323
$scope . countdown -- ;
0 commit comments