How to read json file

i have json file abc.json
i am accessing it in controller using this:
$http.get(‘abc.json’).success(function(data)

abc.json and controller file is in same directory.

but it is giving 404

Than your path is not correct.

if you request abc.json the file has to be in the same directory

Both are in same directory

So this is probably your project structure:

  • www/
    • js/
      • app.js
      • someController.js
      • abc.json
    • index.html

In order to access the json file from index.html you should put js/abc.json instead of abc.json

1 Like

How @joseadrian described.

In a single-page application (like angularjs apps are) your index.html is the access point and everything has to be relative to the index.html-path.