UNPKG

892 BJavaScriptView Raw
1/**
2 * Initialize the ionic.native Angular module if we're running in ng1.
3 * This iterates through the list of registered plugins and dynamically
4 * creates Angular 1 services of the form $cordovaSERVICE, ex: $cordovaStatusBar.
5 */
6export function initAngular1(plugins) {
7 if (window.angular) {
8 var ngModule_1 = window.angular.module('ionic.native', []);
9 for (var name in plugins) {
10 var serviceName = '$cordova' + name;
11 var cls = plugins[name];
12 (function (serviceName, cls, name) {
13 ngModule_1.service(serviceName, [function () {
14 var funcs = window.angular.copy(cls);
15 funcs.prototype['name'] = name;
16 return funcs;
17 }]);
18 })(serviceName, cls, name);
19 }
20 }
21}
22//# sourceMappingURL=ng1.js.map
\No newline at end of file