app.controller('EntryCtrl', ['$scope', '$http', function($scope, $http){
$http.get(something.json).success(function(data){
$scope.entries = data;
});
abc = $scope.entries.timestamp; <-- not working
}]);
After searching, found that $http is an asynchronous function. So I wrap it in to a function, but still not working.
app.controller('EntryCtrl', ['$scope', '$http', function($scope, $http){
var getEntries = function(){ return
$http.get(something.json).success(function(data){
return data;
});
};
$scope.entries = getEntries();
console.log($scope.entries); // returns undefined
}]);