Last active
April 15, 2021 16:29
-
-
Save justinobney/5629777 to your computer and use it in GitHub Desktop.
Get a reference to some angular service in the console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might want to add an
angular.element(document).scope().$apply()
after adding the notification :-)