I am using angular2 webpack and i want to call local json file using get method but its given me same above error
I tried above solution in my demo cli project its work fine for me but its same in webpack not working
Can any one please help me?
I am using angular2 webpack and i want to call local json file using get method but its given me same above error
I tried above solution in my demo cli project its work fine for me but its same in webpack not working
Can any one please help me?
Put your file (for example data.json) in the assets directory and then retrieve it using the path `/assets/data.json':
this.http.get('/assets/data.json')
Thanks Meir
You correct but if we using angular-cli but in webpack its not create assets folder its not work in my case.
But after many R&D i found answer is same like above but need to define that folder inside config details and put json file inside that folder in my case like
config.devServer = {
contentBase: './src/public',
historyApiFallback: true,
quiet: true,
stats: 'minimal' // none (or false), errors-only, minimal, normal (or true) and verbose
};
So in my case i need to put json file inside public folder.
Its resolve for me.