diff --git a/src/plugins/plugin.ts b/src/plugins/plugin.ts index 7d40780f5..a1b2cbc1a 100644 --- a/src/plugins/plugin.ts +++ b/src/plugins/plugin.ts @@ -88,15 +88,15 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts } function getPromise(cb) { - if (window.Promise) { - return new Promise((resolve, reject) => { - cb(resolve, reject); - }); - } else if (window.angular) { + if (window.angular) { let $q = window.angular.injector(['ng']).get('$q'); return $q((resolve, reject) => { cb(resolve, reject); }); + } else if (window.Promise) { + return new Promise((resolve, reject) => { + cb(resolve, reject); + }); } else { console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 1/2 or on a recent browser.'); }