Angularjs access local json files

You can refer to json file calling them with a GET method, like so:

$http.get('phones/phones.json').success((data) => {
   $scope.phones = data;
});

Check the official AngularJS tutorial to see what you are doing wrong.

Update:

For angular 1.6+ success method is not valid anymore instead use then:

$http.get('phones/phones.json').then((data) => {
   $scope.phones = data;
});

Refer to source here.


You need to deploy your application to some http server, the easiest way to this is using node, here is the exmaple https://www.npmjs.org/package/http-server, or you can change you browser security settings.