我在浏览器控制台开发快速验证过程中测试AngularJS服务。我注入到服务控制台的方式是在这个问题或
变量$注射= angular.injector(['对myApp']);变种SERV = $ inj.get('为myService');serv.doSomething();
这是完全符合AngularJS 1.0.7工作。但是,升级到1.1.5之后,它不会再对服务工作,使用 $ HTTP
服务,没有XHR将被发送。
我测试过注射 $ HTTP
直接,它也不起作用。 AngularJS的changelog似乎在这个问题上没有任何记录。我想知道这里有什么问题吗?
更新:
好像AngularJS 1.0.7 Uncom pressed版本不能正常工作。目前,测试工作版本仅仅是AngularJS 1.0.7精缩。
它适用于Uncom $ P $也pssed。
解决方案 $ HTTP = angular.element(document.body的).injector()得到('$ HTTP')。
然后
$ http.get(...)//或交或任何
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
相关推荐
最新文章