Skip to content

Instantly share code, notes, and snippets.

@justinobney
Last active April 15, 2021 16:29
Show Gist options
  • Select an option

  • Save justinobney/5629777 to your computer and use it in GitHub Desktop.

Select an option

Save justinobney/5629777 to your computer and use it in GitHub Desktop.
Get a reference to some angular service in the console
// Get the injector
var injector = angular.element($0/*'[data-ng-app], [ng-app]'*/).injector();
// Get the service
var Service = injector.get('Service');
// Use it!
// Service.addNotification('Some Notification', 'info');
@mota57

mota57 commented Sep 16, 2017

Copy link
Copy Markdown

how can you do this in angular 4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment