Search Posts

Category: es6-promise

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 […]