$timeout is Angular's wrapper for window.setTimeout.

learn more… | top users | synonyms

0
votes
1answer
28 views

AngularJS $timeout sometimes works sometimes doesn't

I'm experiencing some problems with AngularJS and $timeout. I need to run some code, after the page is loaded. Http.get() loads items and ng-repeat displays them in table. Then I need to run the code ...
35
votes
2answers
7k views

AngularJS $evalAsync vs $timeout

I've been using AngularJS for a little while now, and have found the need to use $timeout every once in a while (Seems to usually be to init a jQuery plugin). Recently, I've been trying to get a ...
0
votes
0answers
182 views

Unit testing services with mocha (no e2e test) on AngularJS with $timeout never finishes

I have a service that needs to call the database through AJAX and this is the test for it: describe 'Cep service', -> cep = undefined $timeout = undefined beforeEach(module('cep')) ...
0
votes
0answers
47 views

Why do I have to use $timeout to update variables in Angular?

I have a directive in a directive. In the deepest directive I have this: directive B: scope.onChange = function () { scope.ngModel = scope.selectedItem.Id; $timeout(function () { ...
1
vote
1answer
162 views

AngularJS - Change Tracking

I'm new to AngularJS. I'm looking at using the $timeout service. I've read that one of the reasons for using $timeout over the JavaScript setTimeout function is because changes to variables in the ...
0
votes
0answers
46 views

$timeout not firing when window isn't in focus?

As part of learning AngularJS, I decided to rewrite Cookie Clicker using it. I have a controller set up and it has (among other things) $scope.Cookies, $scope.CPS (to represent the cookies per ...
0
votes
1answer
773 views

passing objects to $timeout

Is there something special I need to do to access objects inside $timeout functions? I get errors saying routes is undefined when I try and access it in the $timeout function, but outside the ...
0
votes
1answer
155 views

AngularJS cannot seem to take a variable duration for a $timeout

I am trying to implement a function within the controller which will be incharge of showing various notification to the user. the problem is that I want the duration to be a function parameter, and ...
2
votes
1answer
675 views

What's the right way to wait for ng-init values to be set?

I have an "ng-init" directive in my HTML that initializes the value of "data.id" in my Angular.js data model. Let's say for now that I can't change how this works. Now, I want to make an HTTP request ...
1
vote
1answer
2k views

AngularJS: Why and when calling $timeout is required?

Live Demo I created a confirmationDialogHeader directive which is used like so: <ul> <li ng-repeat="item in items"> {{item}} <button class="btn btn-mini" ...
2
votes
1answer
1k views

angularjs save changes after digest has finished

I think this might be quite common use-case with any angular app. I am simply watching some objects on my scope that are changed as part of several digest cycles. After digesting them (changing their ...