What about:
angular.element(document.body).injector().get('MyService');
This is generally not a good practice. But sometimes it is necessary.
Note: document.body is an element. Angular app installed on
Another thing you can consider is to "close" the external api using angular through the factory.
- eg. return your global or name class or api from angular factory.
This is essentially what angular does for you. But instead of creating the link inside angular first and extracting it, you should create it outside and register it with DI as a factory or value.
source share