The one-liner solution is to use the below-mentioned command:
angular.element(document.body).injector().get('serviceName')
Another way would be to get the $scope of a particular element. After that select the element with the DOM inspection tool of your developer tools and then run the below mentioned line of code:-
angular.element($0).scope()