I\'m building a HTML-app with the AngularJS framework. I have some legacy JavaScript actions that needs to access a function within the Angular-object, and I can\'t get it t
angular.element()
expects a DOM element, so if you have this html:
and you want to access its DOM element, use an id:
Then
angular.element($('#myDiv')).scope().info('me')
or without jQuery:
angular.element(document.getElementById('myDiv')).scope().info('me')
should work.
Edit:
If you changed something on the scope, you will probably need to use $apply():
angular.element(document.getElementById('myDiv')).scope().$apply();