$timeout is Angular's wrapper for window.setTimeout.
0
votes
0answers
29 views
Timing out Angular http.get trouble with $timeout
I am trying to timeout a $http.get that takes too long, but also doesn't error out. Here is what I have so far. $timeout doesn't seem to cancel the $http.get. Any help is appreciated.
My $http.get ...
1
vote
3answers
74 views
How can clear $timeout in angularjs
I have this code for image slider and next prev and auto change the image function
scope.next = function () {
scope.currentIndex < scope.images.length - 1 ? scope.currentIndex++ : ...
2
votes
2answers
108 views
Simulate the passage of time in protractor?
I have a few spots where things happen in the UI on a delay using $timeout or $interval. Here's a simplified example:
Controller code:
$timeout(function() {
$scope.showElement = true;
}, 10000);
...
2
votes
1answer
416 views
AngularJS: avoid using $timeout to wait for image loading completion
I'm trying to create my own image carousel as an angularjs directive; I want to keep it as lightweight and unopinionated as possibile, so I thought I'd just create a <carousel></carousel> ...
2
votes
1answer
60 views
Cancel a resource request in angular
I am new to angular so I need detailed solution to this question. I have seen a lot of answers but not according to my situation.
I have a service:
function ticketService($resource, globals) {
...
0
votes
0answers
97 views
How to invoke a filter periodically after some timeout in Angular Js
I have written a filter which accepts a timeStamp in long and format it using moment.My code snippet goes like this :
.filter('formatDateTime1', function ($q, $timeout) {
var formatInToday = ...
0
votes
2answers
130 views
Is any event “on $scope digest finished” or “on view refreshed” in Angular.js?
I'm doing an AJAX request for data that is used in the view for generation of a list. I need to know when the $scope is updated and when the view is rendered after a successful response received, so ...
0
votes
1answer
294 views
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 ...
0
votes
1answer
2k 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 ...
0
votes
0answers
422 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
65 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
263 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
93 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 ...
1
vote
1answer
2k 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
397 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 ...
4
votes
1answer
2k 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 ...
104
votes
2answers
27k 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 ...
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 ...