0

I am writing a timer directive to output the result of a function using a time loop.

http://jsfiddle.net/U3q4U/1/

now the problem I have is that the code works perfectly on jsfiddle - the date updates itself every 4 seconds whilst the numbers increase by 1 every second.

but if you copy and paste the code into a html file (and link to the angularjs library) calling $apply on scope does not work properly - the numbers do not update at regular intervals and will jump (eg from 5 to 8).

The directive in question is this:

<gx:timer interval="1000" fn="fn1" output="out"></gx:timer>

I've tried this on both firefox and chrome. the behaviour are the same.

1 Answer 1

1

Updated your jsfiddle and got it working outside js fiddle w/o issues

The issue might be the multiple <script> tags you are using and defining the same module twice

var app = angular.module('gx', []);
var app = angular.module('gx');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.