I'm trying to import a .json file into my Angular8 project, but for some reason I keep getting the 'Module has no exported member' error.
I tried to simplify the code, but no result this is what I have.
First I added this in the compilerOptions object (tsconfig.json) "resolveJsonModule": true, "esModuleInterop": true,
// assests/example.json
{
"name": "Spaghetti",
"desc": "Vegetarische spaghetti bolgnese",
"rating": 3.7
}
// recipe component
import { example } from '../../../assets/example.json';
constructor() {
console.log(example.name);
}
I keep getting this error: Module '"@angular/recipe-app/src/assets/example"' has no exported member 'example'.ts(2305)
What am I doing wrong?