我试过这段代码没有成功
$http({
method:"GET",
url:"data/mycooljsonfile.json",
eventHandlers:{
onprogress:function(event){
console.log("progress");
console.log(event);
},onreadystatechange:function(event){
console.log("change");
console.log(event);
}
},
uploadEventHandlers:{
onprogress:function(object){
console.log(object);
}
}
})
.success(function(json){ // succès
$scope.lemmes=json;
//console.log($http);
}).error(function(error){ // erreur
console.log(error);
});
Run Code Online (Sandbox Code Playgroud)
我查了一下:
https://docs.angularjs.org/api/ng/service/ $ http
那里:
https://www.w3.org/TR/XMLHttpRequest/#events
只是我希望通过大型json文件下载到应用程序的进度条来改进我的代码.
顺便说一句,我找不到一种方法来记录整个$ http对象的函数和支持的事件,因为它返回一个信息很少的promise对象.