Angularjs Visual Studio 2015更新3/cordova更新10 apk大楼的错误?
我已经将我的Visual Studio更新为“更新3”,并且从2016年7月7日起更新了最新的cordorva,基本上我应用了所有更新。我的应用程序似乎失败了 html文件Angularjs Visual Studio 2015更新3/cordova更新10 apk大楼的错误?,angularjs,cordova,ionic-framework,visual-studio-2015,Angularjs,Cordova,Ionic Framework,Visual Studio 2015,我已经将我的Visual Studio更新为“更新3”,并且从2016年7月7日起更新了最新的cordorva,基本上我应用了所有更新。我的应用程序似乎失败了 html文件templates\events.html中有以下代码 <div class="events-2colmn-l backgnd-cover" ui-sref="menu.music"> MUSIC </div> 有一个service.js文件 angular.module('app.servi
templates\events.html
中有以下代码
<div class="events-2colmn-l backgnd-cover" ui-sref="menu.music">
MUSIC
</div>
有一个service.js文件
angular.module('app.services', ['ngResource'])
.factory('EventService', ['$resource', function ($resource) {
return $resource('https://....azurewebsites.net/api/events/:id', { id: "@id" });
}]);
控制器中有
.controller('musicCtrl', function ($scope, EventService) { // called twice when clicked
var allEvents = EventService.query({ category: "Music" });
allEvents.$promise.then(function (response) {
$scope.events = response; // response is undefined after updates
});
})
当使用“Google Android Emulator”进行调试时,参数response
为undefined
(手机上的侧加载得到了相同的行为,因此它也应该得到undefined
)。但是,response
在Ripple中运行或在应用更新之前由Visual studio构建时获得了正确的值
有什么解决办法吗
更新:
在emulator中调试时,我单击了“调用堆栈”中最早的调用,发现以下代码是在ionic.bundle.js中调用的
xhr.onload = function requestLoaded() {
var statusText = xhr.statusText || ''; // statusText is "Not found" but xhr is null
......
completeRequest(callback, // call stack
status, // 404
response, // ""
xhr.getAllResponseHeaders(), // xhr is null
statusText); // Not found
但是,将光标置于状态
上,显示404。url的正确值为“…”
我尝试在emulator中打开一个浏览器,我可以访问internet链接并获得webapi输出
更新2:
ripple和emulator之间有一点不同。我设置断点如下。单击项目后,两个项目上的涟漪都会断开。然而,在emulator中,第一次代码只会在第一个断点上中断,继续运行,然后中断两个断点
.controller('musicCtrl', function ($scope, EventService) {
var allEvents = EventService.query({ category: "Music" }); // Emulator stops twice here
allEvents.$promise.then(
function (response) {
$scope.events = response; }, // Ripple stops here after one top break
function (e) {
console.log(e); } // Emulator stops here after two top breaks
);
})
请检查internet for Google Android Emulator是否可用。@它应该可用。我记得我在仿真器内尝试了浏览器,我一直收到电子邮件。很抱歉反应太晚,你收到任何错误消息吗?@ElvisXia MSFT Hi Elvis,我已经更新了一些新发现的问题。“xhr为空”。这似乎与代码有关,你能分享一个可以重现这个问题的基本演示吗?
.controller('musicCtrl', function ($scope, EventService) {
var allEvents = EventService.query({ category: "Music" }); // Emulator stops twice here
allEvents.$promise.then(
function (response) {
$scope.events = response; }, // Ripple stops here after one top break
function (e) {
console.log(e); } // Emulator stops here after two top breaks
);
})