AngularJS promise not resolving file with FileReader
This question already has an answer here:
您没有onload事件,因此它实际上不会返回读取的文件数据。
this.fileRead = function(file) {
var deferred = $q.defer();
var reader = new FileReader();
reader.onload = function() {
deferred.resolve(reader.result);
};
reader.readAsDataURL(file);
return deferred.promise;
};
链接地址: http://www.djcxy.com/p/55518.html
上一篇: Angular2:回归诺言