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
1 answer

Cancel promise with message

In a typeahead scenario, I am cancelling the previous call, in case it hasn't returned yet and a new call has been made, using the below code: function($http, $window, $q, $timeout){ var suggestions = []; var cancel = $q.defer(); …
gaurav5430
  • 12,934
  • 6
  • 54
  • 111
0
votes
2 answers

Angular http call within an http call

I set up a function in my service to return a list of servers/hosts that are related to a certain application. For front end purposes I have been trying to assign the host a color depending on how many services on that host are running…
0
votes
2 answers

How to handle Promise error? JS/Java

This is my JavaScript code, it handles the promise as you see: this.buy = function(coupon) { var flag = confirm("Are you sure you want to buy coupon #" + coupon.id + "?"); if (flag) { var promise =…
Daniel Liverant
  • 57
  • 1
  • 2
  • 9
0
votes
1 answer

Angular 2: How to create Delete service but just updating the status as inactive

I am new to Angular, by the way. I have a delete button that shows a confirmation dialog to the user on whether to really delete an employee or not. When user chooses YES, frontend would pass the employeeID to the backend and the service should just…
Char
  • 2,073
  • 8
  • 28
  • 45
0
votes
1 answer

how to allow for sorting only when the network call is finished in angularjs

I have a function that I am calling to splice through some list of items and will make a network call to send in the newly ordered list to the DB. My problem is that I want to only allow for users to re-order once the network call is finished. I’m…
jeremy
  • 433
  • 1
  • 8
  • 30
0
votes
1 answer

Resolve promise in angular js and set it for another factory

I have a following factory .factory('UserData', ['User', '$q', function(User, $q) { var deferred = $q.defer(); return { user: null, get: function() { var _this = this; _this.user = User.get(); …
Nakul
  • 35
  • 5
0
votes
1 answer

AngularJs forEach logic, not so academic but working

I've got this code working, but i don't think it is the right way to do. I think i need to use $q, but it is difficult to understand for me . I receive correctly this nice array of json (data.data) from my angularJs factory, from my php server-mysql…
user7370387
  • 99
  • 2
  • 10
0
votes
0 answers

AngularJS post is cancelling with a status of -1

I am getting really stuck with an angular js HTTP post. I have been using AngularJs in this particular project for nearly two years, and have never had this issue, it is also identical to other code, that is working in a lot of other places. I am…
JonathanPeel
  • 743
  • 1
  • 7
  • 19
0
votes
2 answers

Issue with AngularJS promises within a factory

I have an angularjs factory like this: 'use strict'; angular.module('frontRplApp') .factory('paymentService', function ($rootScope, $http, config, tools) { var urlBase = config.baseUrl; var paymentService = { …
Jonathan
  • 512
  • 2
  • 5
  • 17
0
votes
1 answer

AngularJS Promise does not run a digest

I am new to promise concepts and I'm facing a problem while I'm trying to submit a login form. When the promise is resolved, I want to update the UI by changing the value of a scope variable. Here is the controller method which is called …
Amazoom
  • 631
  • 1
  • 6
  • 9
0
votes
4 answers

Returning data from Service to controller

Been spinning in circles on this and would appreciate any help. Trying to pull data from api in service into my controller and repeat the returned data in an ng-repeat. Have tried to approaches with mixed results. Approach…
0
votes
2 answers

Loop wait till all promises are resolved before the next iteration

This is my requirement with AngularJS: for (var i = 0, len = self.Scope.data.length; i < len; i++) { var data = self.Scope.data[i]; var self = this; //First asynchronous function self.EcritureService.createNewData(data).then(()…
Ahmed Chebbi
  • 9
  • 1
  • 1
  • 8
0
votes
1 answer

Returning Promise< void > instead of Promise

I developed through AngularJS many asynchronous functions with the same signature which is app.Domain.GenericModel.EntityBase (my generic model) This is a sample: get(resource: string): ng.IPromise { …
Ahmed Chebbi
  • 9
  • 1
  • 1
  • 8
0
votes
3 answers

Returning the correct promise in angular

I'm having trouble returning the correct promise for a service in angular. this is my function: postToSP.post($scope.sharePointURL, data).then(function() { $scope.gettingData = false; $scope.yammerListName = "Successfully…
Ali_bean
  • 341
  • 3
  • 14
0
votes
0 answers

Return chain of promises in AngularJS

I have the following code: var service = { startSetup: function() { //If not logged in, redirect to login page console.log('starting setup, checking login status'); return LoginService.loginStatus().then(function(result) { …
Si-N
  • 1,495
  • 1
  • 13
  • 27