Assuming debug data is enabled, each element in your application contains a scope()
function for retrieving the scope associated with that element. Additionally, there is an injector()
function that allows you to access the injector instance for your app. To utilize this functionality, consider the following:
javascript:angular.element('[ng-app]').injector().get('myService').hello()
It may be more advisable to only expose specific functions on the window object that require external access.
To achieve this, you can modify your code as follows:
angular.module('myApp').service('myService', function(yourDependencies..., $window) {
//Your code
$window.hello = this.hello;
});
With these adjustments, your Android implementation would then resemble:
view.loadUrl("javascript:hello()");