Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Excel Angularjs中保存json数组_Json_Angularjs_Filesaver.js - Fatal编程技术网

在Excel Angularjs中保存json数组

在Excel Angularjs中保存json数组,json,angularjs,filesaver.js,Json,Angularjs,Filesaver.js,如何将从后端返回的Json数组保存到Angularjs中的Excel文件中 这是连接到后端的查询。它应该返回一个Excel文件,但不知何故它返回了一个Json数组 curl-o orders.xlsx-标题授权:xxxxxxx-标题应用程序/vnd.openxmlformats-officedocument.spreadsheetml.sheet 我找到了这个样本,但它并不完全符合我的需要。特别是,它将Json转换为字符串,Json不是数组 如果我把前三行改成 var data = [{a:1}

如何将从后端返回的Json数组保存到Angularjs中的Excel文件中

这是连接到后端的查询。它应该返回一个Excel文件,但不知何故它返回了一个Json数组

curl-o orders.xlsx-标题授权:xxxxxxx-标题应用程序/vnd.openxmlformats-officedocument.spreadsheetml.sheet

我找到了这个样本,但它并不完全符合我的需要。特别是,它将Json转换为字符串,Json不是数组

如果我把前三行改成

var data = [{a:1}, {b:2}, {c:3}];
var blob = new Blob([data], {type: "application/json"}); 
输出内容为:

[object Object],[object Object],[object Object]

我想使用FileSaver.js,这可能会有所帮助。有什么建议吗?看看这个