1
我有一個評級系統和API來處理評級。在Get
方法如下代碼:IE9資源反應的字符數組而不是JSON對象
public JToken Get(string vid) {
JToken result = null;
var status = new {
Rating = 100,
UserRated = true
};
result = JsonConvert.SerializeObject(status);
return result;
}
,並在我的服務,我做的事:
factory('Rating', ['$resource',
function ($resource) {
var src = config.getValue("api.rating");
return $resource(src, {}, {
get: {
method: 'GET',
withCredentials: true,
responseType: 'json'
}
});
}])
在Firefox和Chrome
這工作得很好,當我做:
Rating.get({ vid: $scope.video.Id }, function (res) {
$scope.videoRating = res.Rating;
}
但在IE9它從正在返回的字符串中獲取一個char數組。 有人可以告訴我發生了什麼,我該如何解決?
嘗試清除緩存: http://stackoverflow.com/questions/22871236/getting-angularjs-resource-in-msie-9-returns-empty-array – alex
@alex,試了一下,沒有改變的結果 – Kiwi
如果你有開發人員工具檢查網絡和檢查反應。 – Innovation