babel-plugin-promise-to-q
Turns native promises into angular $q service
Why?
Babel uses native browser promises, which in most cases are perfectly fine, but they can cause some problems if you are using babel with Angular 1. Since Angular already relies on the $q service, this plugin converts the native browser promises to also use the $q service. This eliminates $digest problems that happen when mixing the two types of promises.
Example
In
{ try if something ; else ; catch error ; };
Out
;
Installation
$ npm install babel-plugin-promise-to-q
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins promise-to-q script.js
Via Node API
;