Questions tagged [angular-promise]

Angular's $q promises provide a powerful abstraction over flow control. If you tag your question with this tag, consider also tagging it with "promise" tag. This tag is also appropriate for questions about angular and promises not relaying to $q directly.

Angular's $q promises provide a powerful abstraction over flow control. If you tag your question with this tag consider also tagging it with the promise tag.

This tag is also appropriate for questions about angular and promises not relaying to $q directly.

2114 questions
0
votes
0 answers

canceling http request in angular 1.5

We are making an HTTP request based upon user input. So each time the user inputs a character, an HTTP request is kicked off. The issue we are having: the user will enter ABC and then enter ABCD. ABCD will respond before ABC. Thus, the displayed…
Chris Bolton
  • 2,162
  • 4
  • 36
  • 75
0
votes
1 answer

Router reset config not working asynchronously - Angular 2

I have to reset my router config dynamically So I used this //to redirect from AppComponent to LoggedInComponent //without changing the path this._router.resetConfig([ { path: '', component: LoggedInComponent } ]); It worked fine in…
0
votes
1 answer

Waiting for a promise to be solved to solve another promise in Angular.js

I have a nested promises and one promise depends on the result of the other so is it possible to force Angular.js to solve a gien promise before solving the second. Here is my code: User.getAllUsers().then(function(users) { $scope.users =…
juliana Morales
  • 177
  • 3
  • 3
  • 10
0
votes
1 answer

Angular jasmine 2 $q promise not calling .then

I'm really surprised and don't know what's going on and what could be the solution... I'm testing with this piece of code. .then is never being called!: describe('PicturesSvc.updatePicturesList', function () { beforeEach(module('com.myapp')); …
Miquel
  • 8,339
  • 11
  • 59
  • 82
0
votes
1 answer

function end before angularjs promise resolve

$scope.clickfunction = function(arg){ var url =""; var httppromise = $scope.promiseufunction(arg); // return a http promise httppromise.then(function(res){ if(res){ url ="path/" $('#htmlelement').attr('href', url); …
GlassMan
  • 31
  • 6
0
votes
1 answer

Cannot find name Promise

I am having trouble using Promise in angular2. I have imported all files as suggested by angular docs. But get the error "Cannot find name Promise". Below is my code: import { Injectable } from '@angular/core'; import { Headers, Http, Response }…
Peter
  • 10,492
  • 21
  • 82
  • 132
0
votes
0 answers

How does this promise response work

So I have simplified but mimicked this service from a project I am working on at work in an attempt to try and better understand the code that has been written. The mimicked service below: angular.module('test').service("giftCardService", ['$http',…
user1806692
  • 143
  • 1
  • 10
0
votes
3 answers

My angular promise unexpectedly goes to error callback, why?

I have a client running on Angular + typescript. I need to send a post request to a php API (which I developed). The request arrives correctly to the server and the server fills the response body with the correct data (I have checked it myself…
Driond
  • 1
  • 1
0
votes
1 answer

Angular UI - angular-google-maps. Is It possible to configure uiGmapGoogleMapApiProvider.configure(options) dinamically?

Is It possible to insert options dinamically from promise (ex. $http.get(...)) in to .config(function(uiGmapGoogleMapApiProvider) { uiGmapGoogleMapApiProvider.configure(); }) of angular-ui angular-google-maps…
0
votes
0 answers

Angular promises and digest cycle

I learned from this post that angular resolved promises cannot execute their 'then' function until next digest cycle: Angular JS: Chaining promises and the digest cycle Code of that original question is here http://jsfiddle.net/QZM4d But there is…
axings
  • 133
  • 7
0
votes
1 answer

AngularJS Nested Promise

I'm trying to return this .register() method: var deferred = $q.defer(); $cordovaPushV5.initialize($constants.PUSH_OPTIONS).then(function () { $cordovaPushV5.onError(); $cordovaPushV5.onNotification(); return…
user1027620
  • 2,745
  • 5
  • 37
  • 65
0
votes
2 answers

how to use $q.all for async forEach requests?

I need to call the function after 2 request is done. So I try to use $q.all for this. I have service on Angular it calls submitForm, before submit I need to do 2 another request, and after they response - make post request to submit form. It looks…
YoroDiallo
  • 345
  • 3
  • 6
  • 26
0
votes
1 answer

Use of Promise in method returning Observable cause error

In my code I have custom post method that extents the http class of angular 2. post(url: string, body: string, options?: RequestOptionsArgs): Observable { if (!this._gs.externalRequest) { let that = this; …
Naveed Ahmed
  • 10,048
  • 12
  • 46
  • 85
0
votes
2 answers

Angular promise .then() repeated?

I have a function which returns a promise which is resolved if the user is currently logged in, or waits to resolve once the user has logged in. SO you can do this... myService.waitForLogin().then(function(){ // Subscribe to pusher.com…
jonhobbs
  • 26,684
  • 35
  • 115
  • 170
0
votes
3 answers

Data not binding issue in angular 2

I'm new to angular 2 and in my component's ngOnInit() I'm calling a service to get some data. This is my component ngOnInit() code import { Component, OnInit } from '@angular/core'; import { Model } from './model'; import { CustomizeModelService }…
Mujahid
  • 1,227
  • 5
  • 32
  • 62
1 2 3
99
100