Why is the $sope.b not being populated?
I'm trying to reach to the JSON that is received from the $http in the service through the service but it appears always as undefined I've added a snapshot of the output.
var app= angular.module("myApp");
app.service('RepoService', function($http){
this.data= function(callBack){
$http.get('/Data/list.json')
.then(function(response){
console.log(response.data);
callBack(response.data);
})
}
})
var myApp = angular.module('myApp');
myApp.controller('listCtrl',function($scope,RepoService){
RepoService.data(function(callBack){
console.log(callBack)
$scope.b = callBack
});
console.log("this is b =" +$scope.b);
})
[Somehow its always 'undefined'][1]
