Using ng-csv to create a tsv file

Ultimately, I need to create a TSV file.

I am using AngularJS v1.2.20 with the ng-csv module. So far, ng-csv is great for csv, but it doesn't seem to work with tabbed markup.

My directive looks like

<a ng-csv='getCSVData()' filename='tsv_data_table.tsv' csv-header='headerNames' field-separator="\t">TSV</a> 

but in the end it just puts raw \ t between each cell as if I wanted to use "\\ t" for example

 Bob Tires\t2484775951\t1\t1\t100\t0\t1\t100\t73\t1 

I tried putting \ t in decimal-separator and text-delimiter, and that didn't help.

+5
source share
2 answers

When Angular read field-separator="\t" , it actually avoided \ before passing it to the directive. I made a transfer request that was combined with ng-csv, which fixed this problem.

So the answer is: it now works just using field-separator="\t"

+1
source

Have you tried pasting \ t as an HTML object? That is, like &#09; ? Not sure, but it might help.

+1
source

All Articles