在具有PhoneGap 3.0和AngularJS 1.2的Windows Phone 7.1模拟器中,为什么这不起作用:
angulargap.controller('HomeController', ['$scope', '$routeParams', '$location',
function ($scope, $routeParams, $location) {
$scope.$routeParams = $routeParams;
$scope.$location = $location;
$scope.message = "AngularJS!";
}]);
错误讯息:
ERROR:Error: [$injector:cdep] Circular dependency found:
http://errors.angularjs.org/1.2.0-rc.2/$injector/cdep?p0=
虽然这有效:
angulargap.controller('HomeController', ['$scope', '$routeParams',
function ($scope, $routeParams) {
$scope.$routeParams = $routeParams;
$scope.message = "AngularJS!";
}]);
在此特定方案中注入$ location服务出了什么问题?所有这些功能都适用于桌面浏览器中的Chrome和Internet Explorer。但它不适用于Windows Phone 7设备模拟器,也不适用于物理设备本身。
答案 0 :(得分:3)
得到它们...... AngularJS / PhoneGap / WindowsPhone组合存在大量问题。这个是https://github.com/angular/angular.js/issues/2303?source=cc#issuecomment-20770025解决的。
基本上,因为Windows Phone使用带有单个正斜杠(x-wmapp0:/)
的奇怪协议前缀,所以$ location初始化程序会发生错误并触发错误,该错误会在这个奇怪的错误消息中以自己的方式暴露自身,与错误完全无关:-(
我准备就GitHub上的AngularJS回购提出一个拉动请求。