can you please tell how to how to read json file.I am able to read json file using controller .but there is way to read file from factory .When I use factory am getting null contend..why ? http://plnkr.co/edit/THdlp00GuSk1NS6rqe5k?p=preview
app.controller("ctrl",['$scope',"$http",'mainInfo',function(s,$http,mainInfo){
s.students = [];
s.guitarVariable = [];
console.log(mainInfo);
s.guitarVariable = mainInfo.content;
/* $http.get('color.json').success (function(data){
s.guitarVariable = data;
}).error(function(err){
alert(err);
}); */
}])
Using this code in controller I am able to get data .But using factory I am getting null
/* $http.get('color.json').success (function(data){
s.guitarVariable = data;
}).error(function(err){
alert(err);
}); */