与离子框架内工作的角度定时器指令 [英] angular timer directive not working with ionic framework

查看:100
本文介绍了与离子框架内工作的角度定时器指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有实现与离子框架的角度定时器指令的问题。
http://siddii.github.io/angular-timer/

I am having issues with implementing the angular timer directive with the ionic framework. http://siddii.github.io/angular-timer/

当我使用凉亭实现code或谷歌CDN我没有问题。

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>

然而,当我使用离子束
<一href=\"http://$c$c.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js\">http://$c$c.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js
我不能让定时器工作。
而且似乎没有得到在控制台中的任何错误。

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?

你会从工作阻止它?

有没有可以让人reccomend备用计时器?这一次似乎是最好的给我?

Is there an alternate timer that people can reccomend? This one seemed the best to me?

推荐答案

尝试看着这个code这里示例:
http://siddii.github.io/angular-timer/ examples.html#/ angularjs单定时器

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');

不是

element.start();

顺便说一句,你的NG-的应用程序应该在html / body标签,而不是在计时器标签。

BTW, your ng-app should be in the html/body tag, not in the timer tag.

这篇关于与离子框架内工作的角度定时器指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆