Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
1  
Does it work if you get access to the $rootScope service and call $rootScope.$apply() ? I ran into a sort-of-similar issue the other day, and kicking off a digest cycle was the fix. –  Brandon Tilley Sep 4 '13 at 3:51
    
@BrandonTilley That works fantastically! So is`$http` changed to be like $q that will only be resolved in a digest cycle? I think I should read the changelog more closely. Thanks! –  Park Soon Wai Sep 5 '13 at 3:37
    
Yes, I think so. I thought maybe I had imagined it working without a digest cycle, but you've helped me realize I'm not out of my mind (at least not because of this. :) –  Brandon Tilley Sep 5 '13 at 3:45
    
@BrandonTilley Me too thought it will work without a digest cycle, at least not for sending xhr. :) –  Park Soon Wai Sep 5 '13 at 4:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.