ng1.js 972 B

1234567891011121314151617181920212223242526
  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. *
  6. * @param plugins
  7. */
  8. export function initAngular1(plugins) {
  9. if (typeof window !== 'undefined' && window.angular) {
  10. var ngModule_1 = window.angular.module('ionic.native', []);
  11. for (var name_1 in plugins) {
  12. var serviceName = '$cordova' + name_1;
  13. var cls = plugins[name_1];
  14. (function (serviceName, cls, name) {
  15. ngModule_1.service(serviceName, [
  16. function () {
  17. var funcs = window.angular.copy(cls);
  18. funcs.__proto__['name'] = name;
  19. return funcs;
  20. },
  21. ]);
  22. })(serviceName, cls, name_1);
  23. }
  24. }
  25. }
  26. //# sourceMappingURL=ng1.js.map