So, I'm trying to set up a $resource which is backed by the json api for spreadsheet data.
https://developers.google.com/gdata/samples/spreadsheet_sample
Here's what I've tried so far:
<html ng-app>
<head>
<title>All That Data</title>
<script>
function AgencyCtrl($scope, $resource) {
$scope.key = "0AnxoLlU0hUtvdHcwUm15NVQwVEdJNzBJUmYxcE03bWc";
{atl: 'json-in-script', callback:'JSON_CALLBACK'},
{get: {method: 'JSONP'}});
$scope.data = []
$scope.fetch = function() {
$scope.data = $scope.Sheet.get({key: $scope.key, sheet: 1});
}
}
</script>
<body>
<h1>All That Data</h1>
<button ng-click="fetch()">Fetch</button>
<div ng-controller="AgencyCtrl">
<span ng-show="data.length == 0">Loading ...</span>
<span ng-hide="data.length == 0">{{ data.length }} Results!</span>
<p ng-repeat="agency in data">
<span ng-repeat="(label, value) in agency">{{ label }}<b>:</b> {{ value }} <br/></span>
</p>
</div>
</body>
</html>
When I load the page, I get the following error on the javascript console:
Is that documentation correct?
Also, in the future, I'd like the app to call fetch() as soon as everything is bootstrapped. Is that something I should do in an ng-init call?
Thanks,
Pepper