我将文件从我的 Controller 发布到我的服务器,gridfs 在其中写入它们。之后,有一个 writestream.on('close') ,我可以在其中将 file._id console.log 到终端。
如何将 Angular Controller 中的变量设置为 file._id? 服务器不知道什么是 Angular,那么我该如何访问它呢?另外, Angular 文件上传会自动发布帖子,所以我不确定如何添加回调。
最佳答案
您可以查看示例以获取完整的订阅者列表。这可能就是您正在寻找的:
uploader.onCompleteItem = function(fileItem, response, status, headers) {
console.info('onCompleteItem', fileItem, response, status, headers);
};
关于angularjs - 使用 angular-file-upload 将文件发布到 gridfs 后获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32086737/