I've testing AngularJS services in browser console during development for quick verification. The way I inject a service into console is as describe in this question or
var $inj = angular.injector(['myApp']);
var serv = $inj.get('myService');
serv.doSomething();
That was working perfectly with AngularJS 1.0.7. However, after upgrading to 1.1.5, it doesn't work anymore for services that uses $http
service, that no xhr will be sent.
I've tested injecting $http
directly, it also doesn't work. AngularJS changelog seems to have no record on this issue. May I know what's the problem here?
Update:
It seems like AngularJS 1.0.7 Uncompressed version doesn't work as well. Currently the tested working version is only AngularJS 1.0.7 Minified.
It works for Uncompressed also.
$http = angular.element(document.body).injector().get('$http');
then
$http.get(...) // or post or whatever
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With