0
我在为我的数据访问的js文件下面的代码:
GroupsApp.factory('availableQuestionRepository', function ($http, $q) {
var factory = {};
factory.get = function (groupID) {
var deferred = $q.defer();
var url = "questiongrouping/AvailableQuestions/";
url = url.concat(groupID)
$http.get(url).success(deferred.resolve).error(deferred.reject);
return deferred.promise;
}
factory.save = function (availableQuestions) {
var deferred = $q.defer();
$http.post("questiongrouping/PostQuestions", availableQuestions)
.success(function() { deferred.resolve(); })
.error(function() { deferred.reject(); });
return deferred.promise;
};
return factory;
})
而且控制器,如下所示:
GroupsApp.controller("availableQuestions", function ($scope, availableQuestionRepository, msgBus) {
$scope.$on('GroupChanged', function() {
loadAvailableQuestions();
});
$scope.save = function (aq) {
availableQuestionRepository.save(aq).then(
function() { alert("sucess") },
function() { alert("error") });
}
function loadAvailableQuestions() {
availableQuestionRepository.get(msgBus.groupID).then(function (AvailableQuestions) { $scope.availableQuestions = AvailableQuestions });
}
});
的MVC控制器代码如下:
Function PostQuestions(result As List(Of QuestionRO)) As ActionResult
Return New HttpStatusCodeResult(System.Net.HttpStatusCode.OK)
End Function
为什么当我用chrome浏览页面时总会弹出错误提示?我已经在IE 10中试过了,它会弹出成功提醒框。
Chrome调试工具显示什么错误? –
不幸的是我在chrome调试工具中看不到任何错误。我应该在哪里寻找错误? – Chris
你应该在网络标签上看到一个关于questionGroup/PostQuestions的问题 –