Search Posts

Category: es6-promise

$q in Angular or Promises in ES6

I have a project using ES6 and AngularJS, and as far as I found, AngularJS $q promises is synchronous but ES6 promises not. Right? The question is, what are the differences? and when should I use $q or ES6? I know what is the difference between Synchronous and Asynchronous, but got confused between new Promise and AngularJS $q. raise from here Source: AngularJS

How to convert method created to return a promise with $q library to use an ES6 Promise. Angularjs app to Angular4+

Since the ES6 Promise does not have a deferred object confused on how to go about converting this to work with ES6 Promises. One solution that I was looking at is to add a deffered object manually to the Promise Constructor. see the No deffered section for the example code Reason: I am converting the angularjs app to angular4 and using it to better understand how to work with ES6 Promises. I was going to […]

ES6 Promise error not bubbling up as expected [duplicate]

This question already has an answer here: Why is the Promise reject() in my jest.mock going to a then() rather than a catch()? 2 answers Is there an easier/proper way for when a promise error’s for it to bubble up to when it is called in a second promise without having to reject the promise in it’s catch block each time manually? promise1() { return this.$http .get(“/url”) .then(response => { // do things }) .catch(err […]