How to start and reset angular timer from controller?

2.6k Views Asked by At

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();
}
1

There are 1 best solutions below

1
Younis Ar M On BEST ANSWER