Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
component - CSVをエクスポートするやつ
private downloadFile(data: any) {
var blob = new Blob([(<any>data)], { type: "text/csv" });
let csvFileName = "日本語ファイル名称.csv";
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, csvFileName);
} else {
//IE以外(Chrome, Firefox)
let link = document.createElement("a");
link.setAttribute("href", window.URL.createObjectURL(blob));
link.setAttribute("download", csvFileName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment