Questions tagged [angularjs-timeout]

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

$timeout is Angular's wrapper for window.setTimeout. The fn function is wrapped into a try/catch block and delegates any exceptions to $exceptionHandler service.

The return value of registering a timeout function is a promise, which will be resolved when the timeout is reached and the timeout function is executed.

Source

23 questions
1
vote
1 answer

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 $scope don't get updated in the UI until…
JQuery Mobile
  • 6,221
  • 24
  • 81
  • 134
1
vote
1 answer

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 $timeout function (where the console log is) it logs the…
andro1d
  • 568
  • 2
  • 11
  • 20
0
votes
2 answers

Create automatic javascript queue with time out to shift items

What I'm trying to achieve is very straight forward but I'm confused. I'm trying to make a queue that holds hospital patients, they will be logged in the system, added to an array (FIFO) and then after a certain interval, they should be removed from…
0
votes
1 answer

AngularJS: $timeout within directive's controller using "this"

Not sure if everything is wired up here correctly. The objective is to call the nextSlide function, for it to change the class, wait a second, then incrament the current picture by 1, and then change the class back. I think the problem is the scope,…
0
votes
0 answers

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')) beforeEach(inject(($cep, $injector)-> cep = $cep …
pocesar
  • 6,860
  • 6
  • 56
  • 88
0
votes
0 answers

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 () { scope.changed(); }, 0); } In the directive on…
Martijn
  • 24,441
  • 60
  • 174
  • 261
0
votes
0 answers

$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 second), and an Update function like so: $scope.Update =…
Corey Ogburn
  • 24,072
  • 31
  • 113
  • 188
0
votes
1 answer

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 that doesn't seem to work. How come?. How can I fix…
Oleg Belousov
  • 9,981
  • 14
  • 72
  • 127
1
2