Hello, I created a JSON file and I'm having trouble listing the data from it, I can get it from the controller, but I want it to be displayed from json, how should I proceed?
Hello, I created a JSON file and I'm having trouble listing the data from it, I can get it from the controller, but I want it to be displayed from json, how should I proceed?
The request to read data from a JSON file basically works as a GET request for a backend application API.
You can do it inside a factory:
function recuperar(){
return $http.get("api/arquivo.json").then(function(resposta){
service.arquivo = resposta.data;
});
};
Where "api / file.json" is the address, from the root of your project, where the JSON file is.