In Angular a JSON file can be imported very easy with
import * as data from './mock.json';
when setting "resolveJsonModule" in tsconfig.json to true
.
Is there a comparable functionality to import csv files?
In Angular a JSON file can be imported very easy with
import * as data from './mock.json';
when setting "resolveJsonModule" in tsconfig.json to true
.
Is there a comparable functionality to import csv files?
You need to change angular's web-pack configs with @angular-builders/custom-webpack
and then use something like csv-loader
Check out Angular CLI: Custom webpack Config for using @angular-builders/custom-webpack
, and also check out Adding a csv file to a webpack build