angular-promise Questions
35
Solved
What is the difference between Promise and Observable in Angular?
An example on each would be helpful in understanding both the cases. In what scenario can we use each case?
Pink asked 21/5, 2016 at 15:43
6
Solved
So I have a situation where I have multiple promise chains of an unknown length. I want some action to run when all the CHAINS have been processed. Is that even possible? Here is an example:
app.c...
Aguascalientes asked 13/2, 2014 at 16:5
5
Solved
In my Angular 7 application I have next function:
getUserData(uid) {
return this.fireStore.collection('users').doc(uid).valueChanges().subscribe(data => {
this.writeCookie(data)
this.curren...
Brimstone asked 9/4, 2019 at 18:49
14
Solved
I'm looking at this example from Angular's documentation for $q, but I think this probably applies to promises in general. The example below is copied verbatim from their documentation with their c...
Dink asked 8/4, 2015 at 13:42
3
My login component briefly displays before being removed by an error message about an undefined object in a promise.
Here is the promise definition:
static init(): Promise<any> {
Keycloak...
Rato asked 24/4, 2018 at 15:27
5
How can I stop a request in Angularjs interceptor.
Is there any way to do that?
I tried using promises and sending reject instead of resolve !
.factory('connectionInterceptor', ['$q', '$timeo...
Threewheeler asked 24/8, 2014 at 15:53
2
Solved
Can somebody tell me if there is a difference between using an error callback vs. a catch function, when using $q.promise please?
E.g. are the two snippets of code functionally equivalent?
functi...
Caruso asked 23/9, 2015 at 16:41
6
Solved
From here: https://mcmap.net/q/45060/-what-is-the-difference-between-promises-and-observables
First this answer describes how Observables are helpful in preventing same repeated requests to the ser...
Dornick asked 18/8, 2020 at 5:57
2
Solved
I am trying to improve my knowledge of Angular2 by migrating an application currently written in Angular1/AngularJS.
One feature in particular has me stumped. I am trying to replicate a feature whe...
Race asked 23/2, 2016 at 1:5
4
I am trying to get data assigned to a $scope variable. Inside my $promise.then() function it is displaying correctly but outside the function it shows as undefined. The following is my controller c...
Pastorship asked 12/8, 2014 at 21:35
3
I observe that In angular 2 there is no finally block for promise API
angular 1 :
loadUsers() {
fetch('/api/users').then((response) => {
return response.json();
}).then((data) => {
thi...
Distinguish asked 16/11, 2016 at 21:41
1
Solved
When calling a function that returns a promise, comes back as undefined unless async operators are removed, then returns ZoneAwarePromise, but contains no data.
I know the query returns data when ...
Visigoth asked 22/10, 2019 at 20:37
2
I keep trying to use tutorials but can't seem to figure out how to use Promises or async await.
I have an http GET request and I want to wait for the result from the API before returning. T...
Era asked 15/8, 2019 at 14:34
6
Solved
How can I handle an HTTP error, e.g. 500, when using the AngularJS "http get then" construct (promises)?
$http.get(url).then(
function(response) {
console.log('get',response)
}
)
Problem is, ...
Briarroot asked 13/6, 2013 at 5:58
3
Solved
I want to make a war file to deploy the angular2 project in an apache tomcat server. I made a maven project and inserted the angular2 project inside it. Then I made the webapp folder(instead of the...
Frei asked 21/9, 2016 at 11:3
2
Solved
I'm working on a Spotify app. I'm able to login and get my token. My problem is I cannot access a variable outside the method. In this case "getCurrentUser"
This is my method:
function getUser()...
Seadon asked 29/11, 2017 at 18:55
1
Solved
Hi im using angular 6 to call a rest api with the code below. I am trying to acheive making the code synchronous with the async-await function. however something is missing
async save() {
if (th...
Reward asked 6/12, 2018 at 16:46
7
Solved
I have a list of objects. The objects are passed to a deferred function. I want to call the function with the next object only after the previous call is resolved. Is there any way I can do this?
...
Cistern asked 11/3, 2015 at 9:58
3
Solved
I want to implement a dynamic loading of a static resource in AngularJS using Promises. The problem: I have couple components on page which might (or not, depends which are displayed, thus dynamic)...
Endothelium asked 11/9, 2013 at 15:5
1
Solved
I have written a bit of code that allows a user to upvote / downvote recipes in a manner similar to Reddit.
Each individual vote is stored in a Firestore collection named votes, with a structure l...
Clare asked 13/8, 2018 at 1:25
3
Solved
I'm finding it hard to understand the "deferred antipattern". I think I understand it in principal but I haven't seen a super simple example of what a service, with a differed promise and one with ...
Yonkers asked 10/6, 2015 at 7:46
5
Solved
I'm trying to get my head around promises in JavaScript (in particular AngularJS).
I have a function in a service, let's call it fooService, that checks if we've loaded some data. If it has, I jus...
Newel asked 17/7, 2014 at 3:29
1
Solved
I've been learning/working on a newbie project which is basicly a simple task manager(similiar to those todo list projects). And I designed a user login page for this project and here is how it wor...
Quincey asked 12/7, 2018 at 19:39
11
Solved
We have a pattern for resolving promises in our Angular app that has served us well up until Angular 1.6.0:
resource.get().$promise
.then(function (response) {
// do something with the re...
Inandin asked 9/12, 2016 at 15:38
8
Solved
Given a Ajax request in AngularJS
$http.get("/backend/").success(callback);
what is the most effective way to cancel that request if another request is launched (same backend, different paramete...
Slaughter asked 18/12, 2012 at 7:12
1 Next >
© 2022 - 2024 — McMap. All rights reserved.