Access a json file inside angular 5 component

16 views
Skip to first unread message

Sauryanjan Bhoi

unread,
Jun 11, 2018, 12:19:58 PM6/11/18
to Angular and AngularJS discussion

Hi,

I have created a json file into a angular 5 component, which was created using angular-cli.
But i am unable to read json file in this component.ts file.

PFA: Image of the component folder.

My assumption is, after build the json file is not present in that location.

Does anyone have solution to how i can keep files inside component folder and still be able to access in that component file.

Thanks,
Sauryanjan

sample123.PNG

Thamothara Kannan

unread,
Jun 20, 2018, 11:19:45 AM6/20/18
to Angular and AngularJS discussion
you move to json file in assets folder ,after you can read.
Reply all
Reply to author
Forward
0 new messages