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

Testing controller that depends on a service which is based on resource

I have a controller that calls a Service which is a wrapper for a Resource. Like this: app.factory("Service", ["$resource", function ($resource) { return $resource("/api/Service/get"); }]); Return value of the service's method…
0
votes
1 answer

Angular $http.get request not running success or error functions

I am trying to make a get request to the nutritionix v1_1 api. When debugging I can see that the function is successfully called and the correct data is passed in. When the function hits the $http.get request it skips over the rest of the code(the…
0
votes
0 answers

Promise madness using AngularFire 2 and Rxjs

I have A LOT of promises with some errors especially where you use resolve. I want the two blocks to be Async, One after another, but Its not exactly working. Is this too many promises? Am I implementing them right? SetRoom(){ return new…
0
votes
2 answers

Yet Another Asynchronous service returns Undefined

This is my service: (function () { 'use strict'; angular .module('app') .service('ClientsService', Service); function Service($http) { function getClients() { $http.get('app/client/clients.json') …
FacundoGFlores
  • 7,858
  • 12
  • 64
  • 94
0
votes
2 answers

Resolve multiple promises in route's resolve before initializing controller

I have 2 http calls needed to be reslove before initializing my controller, currenly using Angular UI router and I have resolve map under $stateProvider.state('stateName', {stateObject}) my stateObject as bellow $stateProvider.state('stateName',…
Sohail Faruqui
  • 442
  • 11
  • 27
0
votes
2 answers

Angular Table sorting does not work if i use a different api

i took ngTable example from http://ng-table.com/#/loading/demo-external-array opened it in code pen and instead of "/data" i am using an api https://jsonplaceholder.typicode.com/posts and added isArray : true var Api =…
Raas Masood
  • 1,475
  • 3
  • 23
  • 61
0
votes
1 answer

Getting a state object back from a angular $q deferred call when I should be getting a value

I'm trying to get a value from a backend API into my controller using $q.when in angular. The function on my controller is calling a non-async function in a service that is invoking other functions to call the backend with the $http service.…
JamesNB
  • 27
  • 13
0
votes
1 answer

AngularJS 1.6 and non-Angular event handler

Using AngularJS 1.6 and braintree-web 3.6.2 Hosted Fields. I've wrapped the Braintree callbacks in promises using $q (though new Promise() works fine, too). Right now, I'm simulating $scope.$apply() using $timeout with no time parameter. Here's a…
0
votes
1 answer

Test angular $q with jasmine

I have the following function in my controller: function putActivities () { var promises = []; view.activities.forEach(function (activity) { promises.push(API.putActivities({activity: activity}).$promise); }); …
cscan
  • 3,684
  • 9
  • 45
  • 83
0
votes
2 answers

$http AngularJS calls stored in array sequentially

I've been looking and looking everywhere for an example of how to get this to work appropriately. I've tried using $q.all() and it doesn't work. I can't seem to get promises to work appropriately or I'm not accessing them correctly. I'm making an…
tjg92
  • 197
  • 2
  • 3
  • 12
0
votes
1 answer

In Jasmine derivative promises gets resolved incorrectly

Gist: I spy on get method of my rest service: spyOn(restService, 'get').and.callFake(function () { return deferred.promise; }); The method I am trying to test is myService.getFormData() that returns a chained promise: function…
Ace
  • 1,501
  • 4
  • 30
  • 49
0
votes
3 answers

Cancelling an angular service promise

I have a controller that performs a http request. This request can take anywhere between 2 seconds to 4 minutes to return some data . I have added a button, that users should click to cancel the request if searches take too long to…
Oam Psy
  • 8,555
  • 32
  • 93
  • 157
0
votes
1 answer

$scope.$watch value wrapped in in promise $q.when(value)

In my app I have a service that asynchronously returns cached value: .service('StateService', [ '$q', function ($q) { var value; // ... // ... function getValue() { …
0
votes
1 answer

how to return from nested promises in angularjs

I have a nested promises as follows. I am just writing the pseudo code to reflect my use case. $scope.result=""; Promise1.then(function1(value1){ Promise2.then(function2(value2) { forloop() { Promise3.then(function3(value3){ $scope.result +=…
user1061216
  • 83
  • 2
  • 7
0
votes
1 answer

AngularJS ngResource $resource query() Returns Empty

I am trying to upload a file from the server but the file is not showing up. The call to the server is initiated from this segment of code: 'use strict'; angular. module('phoneList'). component('phoneList', { templateUrl:…
koque
  • 1,830
  • 5
  • 28
  • 49
1 2 3
99
100