Is there a way to start a timer when the user clicks on the recordLogs
method and reset the timer when the user clicks on the stopLogs
method? According to the angular-timer documentation, we should be able to use the timer-stop
and timer-clear
methods to achieve this task. However, I am encountering an error where start
and clear
are undefined when I try to invoke them from the controller. Any suggestions on how to resolve this?
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();
}