angular-promise Questions

1

Solved

I have a service that wraps $http with my functions returning a deferred object. My interface: export interface MyServiceScope { get: ng.IPromise<{}>; } My class: export class MyService...
Entente asked 12/12, 2015 at 7:50

3

Solved

I am confused between Angular JS deferred and $q. I found this SO Question that explains the difference between $q.defer() and $q.It explains $q.reject is a shortcut to create a deferred and th...
Spitsbergen asked 11/7, 2015 at 17:39

2

Solved

I am using angular-ui-router's resolve to get data from server before moving to a state. Sometimes the request to the server fails and I need to inform the user about the failure. If I call the ser...
Famous asked 21/9, 2014 at 18:21

3

Solved

I am trying to do multiple $http call and my code looks something like this: var data = ["data1","data2","data3"..."data10"]; for(var i=0;i<data.length;i++){ $http.get("http://example.com/"+d...
Hummocky asked 26/9, 2015 at 6:30

1

Solved

Can anyone help me with some Angular promises? I have the following functions that should take in an array of file objects, iterate over them, and upload each one. During each iteration, a promise ...
Polygamy asked 21/9, 2015 at 13:37

3

Solved

I have been reading about $q and promises for days now and I seem to understand it...somewhat. I have the following situation in practice: An $http request is made and checks whether a subsequent...
Inoculate asked 13/9, 2015 at 4:19

3

Solved

In the following code snippet error 1 and success 2 will be logged. How can I can I propagate error callbacks being invoked rather than the success callbacks being invoked if the original deferred ...
Unaccountable asked 18/10, 2014 at 16:49

2

Solved

I am trying to create a service to get json and pass it to me homeCtrl I can get the data but when a pass it to my homeCtrl it always returns undefined. Im stuck. My Service: var myService = ang...

2

Solved

Surprised to see why the angularjs promise is not resolved multiple times using $interval service. Below is my code. The variable i is incremented multiple times, however the promise is resolved on...
Swaim asked 2/10, 2014 at 9:54

1

Solved

Watching a lot of Egghead.io videos, I noticed that a common pattern is to return a custom promise and resolve it in the callbacks. .factory('myFact', function($q, $http) { return { getData: fun...
Scrawly asked 16/3, 2015 at 17:28

1

Solved

The patterns of promises usage still confuse me. For example, in Angular application, I have a service usersService with method emailExists(email). Obviously, it performs request to the server to ...
Patricio asked 29/7, 2015 at 14:15

1

Solved

So I have played around with getting a promise to resolve in a service vs in a controller. I'd prefer to resolve it in the service so I can reuse the variable without having to resolve it multiple ...

2

I am seeing angularJS files where in some places reviewer has commented these 3 lines: var deferred = $q.defer(); deferred.resolve(BrandList); return deferred.promise; and replaced with this one...
Tong asked 6/7, 2015 at 17:6

2

Solved

I have multiple controllers on a page that use the same service, for the sake of example we will call the service USER. The first time the USER.getUser() is called it does an $http request to GET ...
Dibble asked 2/4, 2015 at 19:39

1

Solved

I have 2 $http calls that return promises but the first one is optional. I believe that I have to first create a promise using $q.defer() but I am missing something. Here's my non working attempt:...
Terena asked 24/6, 2015 at 20:43

2

Solved

I'm trying to build a drill-down list with angular and es6 promise. Without using promise my code works as demoed in the snippet below. Every time you click the parent, it expands the children (jus...

3

Solved

Have a look into the code snippet $scope.getSongs = function(keyword){ songServices.getSongList(keyword).then( function(resp){ $scope.songList = resp.data.songList; } ); } Here getSongList ...
Venter asked 12/6, 2015 at 14:6

7

Solved

My service is: myApp.service('userService', [ '$http', '$q', '$rootScope', '$location', function($http, $q, $rootScope, $location) { var deferred; deferred = $q.defer(); this.initialized = def...
Transcendental asked 9/5, 2014 at 14:40

2

Solved

a) What are the difference between $http and $q ? b) When should $q be implement over $http and vice versa ? c) When and best practice for implement $http and $q at the same time?
Selfness asked 28/5, 2015 at 16:17

1

Solved

I am trying to intercept the 401 and 403 errors to refresh the user token, but I can't get it working well. All I have achieved is this interceptor: app.config(function ($httpProvider) { $httpPr...
Aculeate asked 4/5, 2015 at 15:25

3

Solved

I have to execute three different $http-calls sequentially which depend on each other. Until now my working solution is something like this: $http.get(".../1/...").success(function() { $...
Hepta asked 5/5, 2015 at 15:6

2

Solved

For an angular project, I have to nest promises and I run into cases where I am not sure of what I am doing. Here is one of my code : return Action1().then(function (data) { var defer = $q.defer...
Banister asked 16/4, 2015 at 10:29

1

Solved

I'm working on angular and bootstap, using angular-ui-bootstrap bridge library. The thing I want to achieve is to reuse the modal component and wrap it in a promise that would be resolved when the ...

2

Solved

I’m building an angular application that is going to run on several domains. Since there are different configurations on each domain I'll need to fetch all the variables by doing a call to the serv...
Iulus asked 21/3, 2015 at 10:11

3

Solved

I'm working on an $http call that loops over each of multiple api's and returns all of the data in one object. I usually have the promise ready to resolve when the $http call has been made. Similar...
Delarosa asked 20/3, 2015 at 14:0

© 2022 - 2024 — McMap. All rights reserved.