I am having issues with implementing the angular timer directive with the ionic framework. http://siddii.github.io/angular-timer/
When I implement the code using bower or the google cdn I have no issues.
<!DOCTYPE html>
<html>
<head>
<title>Plain Javascript Timer Example</title>
<script src="../bower_components/angular/angular.min.js"></script>
<script src="../app/js/timer.js"></script>
<script>
function startTimer() {
document.getElementsByTagName('timer')[0].start();
}
function stopTimer() {
document.getElementsByTagName('timer')[0].stop();
}
</script>
</head>
<body>
<div>
<h2>Plain JavaScript - Timer Example</h2>
<h3><timer ng-app="timer"/></h3>
<button onclick="startTimer()">Start Timer</button>
<button onclick="stopTimer()">Stop Timer</button>
</div>
<br/>
</body>
</html>
However when I use the ionic bundle http://code.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js I can not get the timer to work. And do not seem to get any errors in the console.
Is this a known issue?
What would be stopping it from working?
Is there an alternate timer that people can reccomend? This one seemed the best to me?
try looking at this code sample here: http://siddii.github.io/angular-timer/examples.html#/angularjs-single-timer
starting the timer in angular is done via
$scope.$broadcast('timer-stop');
not
element.start();
BTW, your ng-app should be in the html/body tag, not in the timer tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With