Angularjs access local json files [duplicate]

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)