Kirill Pakhomov Kirill Pakhomov - 3 months ago 7
AngularJS Question

Retrieving data from the different file

I've got a .json file with a bunch of objects in it. The question is basically how do I retrieve these and pass them to my .js file where retrieved objects will be outputted in the DOM one by one.

Answer

simply make an XHR like other request by just giving path to your json file. You can use angular's $http service to do that.

$http.get("yourFils.json").then(function(result){
console.log(result.data)
})