7 Replies Latest reply on Jun 7, 2017 2:24 PM by aouellet RSS
    aouellet Newbie

    JS Timer Event Controlling Model Properties

    I am attempting to use a simple JS timer function to write values to a variable, which is then bound to the model property "ry"

     

    The idea being, I can click a button to call the function, the the model continuously rotates until the function is cleared.

     

    I created the "counter" parameter and bound it to the "ry" property, as well as defining the click events as their respective functions.

     

    However, the dev console shows that the value is not being stored in "counter" and is not showing as bound to "ry."

     

    My code looks like the below:

     

     

    $scope.set_timer = function(){

      $scope.app.params['counter'] = 0 ;

      $scope.app.params.time=setInterval(function(){

        $scope.app.params['counter'] ++;

        console.log(counter);

      }

      , 1000);

    }

    $scope.stop_time = function(){

      $scope.app.params.time = clearInterval(time);

    }

    ---------------------------------------------------------------------------------------------------------

     

    Any help is greatly appreciated.