angular-timer icon indicating copy to clipboard operation
angular-timer copied to clipboard

no attribute $watch() ?

Open laguiz opened this issue 12 years ago • 1 comments

If I set a variable myTimer when we click on a button with the following HTML but it's seems that it's not working :

<div ng-init="myTimer = 9999999999999">
   Current `myTimer` : {{myTimer}}
   <br/>
   <button ng-click="myTimer = 88888888888888">Change the value to `88888888888888`</button>
   <button ng-click="myTimer = 9999999999999">Change the value to `9999999999999`</button>
   <br/>
   <timer end-time="myTimer">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
</div>

It seems that the plugin does not $watch() the attibutes.

I added this monkey patch code in the plugin to test and it seems to work (line 39) :

$scope.$watch('endTimeAttr', function(newVal){
   if(newVal){
      $scope.start();
   }
});

Did I miss something or we could imagine to add some $watch() in the plugin?

laguiz avatar Apr 01 '14 08:04 laguiz

reproduced at my side as well.

nirdshabo avatar Apr 20 '14 08:04 nirdshabo