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
2 answers

Error in loop index inside promise resource using angularjs

I have this code in angularjs that sends an http request to an API for each index of the loop, the problem is that I want to access the index inside the promise, but this gives me the wrong index. for (var index = 0; index < array.length; index++)…
0
votes
0 answers

Angular Js Search element with promise

Hi we have an angular js controller that call a service function: var decodedValue = StaticTableService.DecodificaAllergeni(listObj); this service function get an array of integer. We want to decode this integer in string from StaticTableService.…
0
votes
4 answers

$q.all() not running all promises before then clause

I need to finish all my ajax calls to enable a button, but I am not getting all my promises done before enabling the button. I have this piece of code with all my ajax gets: $q.all([ $scope.load_ocupacoes(), …
Olivertech
  • 567
  • 2
  • 4
  • 24
0
votes
2 answers

javascript/angular $promise and catch as an independent function

So i have multiple functions that all use approximately the same $promise.then -> catch chaining. I was wondering how i could make this as a separate function to reduce duplicate code. Example of two functions that use "almost" the same…
0
votes
3 answers

Angular - how to chain a promise ($state.go function) to a timeout function?

I m trying to chain a promise to my 'timeout/typewriter effect' function, so once he function is finished another function should be called which is a simple $state.go. Ive been researching and looking at so many posts but whatever I try doesnt…
web2016
  • 47
  • 9
0
votes
1 answer

.then is not defined on devicesIsReady

I'm getting the following error: Uncaught TypeError: loginService.verificarSesion(...).then is not a function I think I don't understand perfectly promise I need to check if the user is logged in on deviceIsReady on my apache-cordova app. This is…
Faustino Gagneten
  • 2,564
  • 2
  • 28
  • 54
0
votes
2 answers

AngularJS Pass variables into looped asynchronous callback

I have a function that loops through in indeterminate number of items and does an asynchronous call on each one to get additional data (the content of html template files). The callback does some checking. The resulting function should be…
nuander
  • 1,319
  • 1
  • 19
  • 33
0
votes
1 answer

AngularJS Promises come back as error yet send things to db successfully

The error I get in the console log using error.status is -1 yet the data I sent to the database was successfully posted. The data shows in my ng-repeat I have for the list. It's very odd because it happens 5% of the time. Here is my Controller: …
DDelgro
  • 463
  • 1
  • 6
  • 16
0
votes
2 answers

Execute $http requests in a particular order

I have about 5 requests that are made when my view loads. This is for an edit form: var reqA = function() {...}; var reqB = function() {...}; var reqC = function() {...}; var reqD = function() {...}; var reqE = function() {...}; Now I want reqA()…
user3718908x100
  • 7,939
  • 15
  • 64
  • 123
0
votes
2 answers

How to get object returned by POST method using angular $resource?

I have the following POST method in my Web API Controller: [HttpPost] public async Task Post(Hotspot hotspot) { try { int id = await SomeMethod(); …
Ionna
  • 223
  • 4
  • 19
0
votes
2 answers

Delayed $scope updates in promise `.then` method

I'm using angularJS and I do this: xxx.then(function (response) { $scope.x = response.x; $scope.y = response.y; }, function (error) {} ); The response come from server not instantantly. Then when the response come, I want than the scope…
anubis
  • 1,425
  • 5
  • 18
  • 47
0
votes
3 answers

Returning Data from Service to Controller with Asynchronous Callback

I'm trying to upload image from Camera or gallery. I wrote all the code in the service. The controller must receive the complete url from the camera or gallery to show it in a slide box, but now nothing receive. Everything works, but I couldn't send…
0
votes
1 answer

Angular / Controller loading a json file fails with an exception I can not understand

sorry, maybe a stupid problem, but I am still a newbie with angular. The code: -- EDIT #2 -- ----- ----- ----- ----- ----- ----- ----- MyApp.controller('DataController', ['$http', function ($http) { var self = this; var objects…
0
votes
4 answers

How to have single finally handler for multiple promises in AngularJS?

I have two promises, independent of each other and I want to do a finally step after both of the promises are completed (either rejects or resolves). $q.all() cannot be used as I want the finally to always execute (only once for both promises) even…
vroy
  • 13
  • 4
0
votes
1 answer

Getting "Type 'Promise' is not assignable to type 'IResourceWeightage'." error when calling method via service method call?

I have this method in one of the service I am using to get ResourceWeightage details: getResourceLevelProgress(learning_node_id: number): Promise { return this.getOverallProgressData() .then(learning_nodes =>…
Jayant Pareek
  • 360
  • 3
  • 18