Skip to content

Instantly share code, notes, and snippets.

@atiq1589
Last active February 25, 2018 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atiq1589/9042b92f595cba695357ae32252f09e7 to your computer and use it in GitHub Desktop.
Save atiq1589/9042b92f595cba695357ae32252f09e7 to your computer and use it in GitHub Desktop.
Getting angularjs controller and scope from outside angularjs
var controller = angular.element("[ng-controller='ControllerName']");
var scope = controller.scope();
var app = angular.element('*[ng-app]');
var service = app.injector().get('ServiceName');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment