# Category: es6-promise

## Where are resolve and reject defined in Promises?

I’m currently following a tutorial on Angular Promises, but I don’t understand how the resolve and reject functions can be executed if they aren’t defined anywhere. I thought I the programmer had to define these functions? Here’s the tutorial. https://toddmotto.com/promises-angular-q Here’s the code. const handleThirdPartyCallback = someArgument => { let promise = new Promise((resolve, reject) => { // assuming some third-party API, that is *not* a Promise Object // but fires a callback once finished […]

## TypeError: Object doesn’t support property or method ‘finally’

I am using angular 1.6 with gulp and es6 promise which has .finally() block, its working fine all other except IE Edge and IE 11. Source: AngularJS

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