hussain
hussain

Reputation: 7103

How to start and reset angular timer from controller?

I want to start timer when user click on recordLogs method and reset timer when user click on stopLogs method. According to angular-timer documentation we can use timer-stop and timer-clear method to achieve these task but i am getting error start and clear undefined on timer when i invoked them from controller. Any idea ?

main.html

 <div class="col-md-3">
           <timer interval="1000">{{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>
 </div>

Ctrl.js

$scope.stopLogs = function() {
    $scope.timer-clear();

};

$scope.recordLogs = function() {
    $scope.timer-start();
}

Upvotes: 0

Views: 2661

Answers (1)

Related Questions