11/**
2- * angular-timer - v1.3.3 - 2015-08-17 4:25 PM
2+ * angular-timer - v1.3.3 - 2015-11-30 10:57 AM
33 * https://github.com/siddii/angular-timer
44 *
55 * Copyright (c) 2015 Siddique Hameed
@@ -19,19 +19,19 @@ var timerModule = angular.module('timer', [])
1919 autoStart : '&autoStart' ,
2020 language : '@?' ,
2121 fallback : '@?' ,
22- maxTimeUnit : '=? ' ,
22+ maxTimeUnit : '=' ,
2323 seconds : '=?' ,
2424 minutes : '=?' ,
2525 hours : '=?' ,
2626 days : '=?' ,
2727 months : '=?' ,
28- years : '=?' ,
28+ years : '=?' ,
2929 secondsS : '=?' ,
3030 minutesS : '=?' ,
3131 hoursS : '=?' ,
3232 daysS : '=?' ,
3333 monthsS : '=?' ,
34- yearsS : '=?'
34+ yearsS : '=?'
3535 } ,
3636 controller : [ '$scope' , '$element' , '$attrs' , '$timeout' , 'I18nService' , '$interpolate' , 'progressBarService' , function ( $scope , $element , $attrs , $timeout , I18nService , $interpolate , progressBarService ) {
3737
@@ -76,7 +76,7 @@ var timerModule = angular.module('timer', [])
7676 $scope . startTime = null ;
7777 $scope . endTime = null ;
7878 $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 ;
8080 $scope . isRunning = false ;
8181
8282 $scope . $on ( 'timer-start' , function ( ) {
@@ -124,8 +124,8 @@ var timerModule = angular.module('timer', [])
124124 $scope . start = $element [ 0 ] . start = function ( ) {
125125 $scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
126126 $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 ;
129129 }
130130 resetTimeout ( ) ;
131131 tick ( ) ;
@@ -159,7 +159,7 @@ var timerModule = angular.module('timer', [])
159159 $scope . reset = $element [ 0 ] . reset = function ( ) {
160160 $scope . startTime = $scope . startTimeAttr ? moment ( $scope . startTimeAttr ) : moment ( ) ;
161161 $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 ;
163163 resetTimeout ( ) ;
164164 tick ( ) ;
165165 $scope . isRunning = false ;
@@ -317,7 +317,7 @@ var timerModule = angular.module('timer', [])
317317 $scope . $digest ( ) ;
318318 } , $scope . interval - adjustment ) ;
319319
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 ] } ) ;
321321
322322 if ( $scope . countdown > 0 ) {
323323 $scope . countdown -- ;
0 commit comments