Hi there, hope you guys will be fine. Actually I m trying to post json data in a local json file store in my assets folder. Here is how I m posting my data, take a look:
The error that I m facing is 404 not found, have a look:
The cool is thing that when I use get request from my httpClient then it works and fetch the empty array which I defined in the file but not with the post request. Need Help to overcome on it , thanks!
Have a good day!
Happy Coding!
First of all, post textual information as text.
Secondly, where are you trying to post this to? An HTTP POST request requires a webserver on the other end that accepts the posted data. GET requests for things in /assets
work only because the underlying WebView that powers Ionic apps knows how to handle them, but they are a special case. /assets
is not a real folder; it doesn’t really live on the device. It’s a figment that’s really backed by the contents of your app binary itself.
So, if your goal is to write this data to /assets
, that’s completely impossible at runtime. The app binary is not writeable. You want something like Ionic Storage to store things that you want to read on later runs of the app (do not use this for in-app communication within the same app run).