Q1: I have the following code:
<script>
function ProductionIndexCtrl($scope, $http) {
$http.get('POD.json').success(function(data) {
$scope.results = data.results;
console.log("Here");
}).error(function(data, status, headers, config) {
console.log('error');
});
};
</script>
That attempts to open POD.json which I have provided in the same directory as index.html. I am currently running this on rails and both files are under the app/assets/templates/production folder. But everytime I run this controller, I fail; to read from POD.json. The rest of the page renders fine.
I know that there are rules for certain browsers and that firefox allows from localfile reading and I am using Firefox to test my results, but still no luck.
Is there something obvious that I am missing? Any ideas?
Q2:
Hi! I have the following code js.coffee:
@temp.controller 'ProductionCtrl', [
'$scope',
'$http',
(($scope, $http) ->
$scope.results =
[
{
"name": "1",
"location": "a",
"status": "g",
"size": "3551"
}
]
But it seems that everytime I run it, I get an error for $scope not defined. I have included ng-app at the top of my views html file, and my ng-controller directive around the $scope that I want to include. But it seems that I am still missing something. Any ideas?