Angular: How to use local json with my content/assets?

Hi, maybe is very basic question but I don't know. I had a project in React and I was trying to do the same in Angular. My JSON is like this: //Import CV File import cvES from "../assets/files/CV.pdf"; //Import Background Header import bgHeader from "../assets/img/bg-header.jpg"; const allContentES = { header: { name: "asdsda.", surname: "asdasdasd", profession: "Web Developer", location: "Argentina", mobile: "(+34) 123 456 789", urlCV: cvES, bgHeader: bgHeader, social: [ { name: "Instagram", url: "https://www.instagram.com/blablabla", }, { name: "LinkedIn", url: "https://www.linkedin.com/in/blablabla", }, { name: "GitHub", url: "https://www.github.com/blablabla", }, ], textDownloadCV: "asdasd", titleTimeline: "asdasd", language: "Change to English", }, I have my assets in the correct path and mi files but always I have the same error that my path is incorrect. Cannot find module "../../assets/files/CV.pdf" and its corresponding type declarations What I'm doing wrong? Should I need do something in angular.json or do it different? Thanks!
1 Reply
Queequeg
Queequeg2y ago
I don't know the answer to your question, but I'd make sure that your asset folder being included in the compiled output? Does this SO help: https://stackoverflow.com/a/64589400
Stack Overflow
Include assets when building angular library
I am building a library which contains a custom icon font. However, when I build my library using ng build <library-name> --prod, the assets folder is not included in the build, which means i...
Want results from more Discord servers?
Add your server