1

I know one can read .json files from disk at compile time and use them in component like:

import * as configFromFile from './my-file.json';
...
let config = configFromFile;

Is there a way to load file in similar manner that is not .json, for example '.txt' or '.csv' file and initialise string variable with it's content?

SDekov
  • 9,276
  • 1
  • 20
  • 50
  • 2
    No it's not possible because JSON means Javascript Object Notation so can be serialize/deserialize as a simple object literal not the case in front of '.csv' or 'txt'. – Echyzen Jan 30 '23 at 15:32
  • 1
    https://stackoverflow.com/questions/55714565/how-to-configure-raw-loader-in-angular-7-to-load-text-files – Petr Averyanov Jan 30 '23 at 16:43

0 Answers0