Sander,
Here is the code that I now have for that specific function:
Todo = $resource("/todos", {id: "@id"}, {update: {method: 'PUT'}})
Todo.query(function (x) {
console.log(x);
$scope.todos= x;
});
When I refresh the page I get one error repeated a few times:
Error: [$interpolate:interr] Can't interpolate: Total todos:
{{getTotalTodos()}} TypeError: Cannot read property 'length' of undefined
http://errors.angularjs.org/1.2.5/$interpolate/interr?p0=Total%20todos%3A%2…%7D&p1=TypeError%3A%20Cannot%20read%20property%20'length'%20of%20undefined<http://errors.angularjs.org/1.2.5/$interpolate/interr?p0=Total%20todos%3A%20%7B%7BgetTotalTodos()%7D%7D&p1=TypeError%3A%20Cannot%20read%20property%20'length'%20of%20undefined>at
http://localhost:3000/assets/angular.js?body=1:79:12<http://localhost:3000/assets/angular.js?body=1>at
Object.$interpolate.fn (
http://localhost:3000/assets/angular.js?body=1:8175:26<http://localhost:3000/assets/angular.js?body=1>)
at Scope.$digest
(http://localhost:3000/assets/angular.js?body=1:11574:40<http://localhost:3000/assets/angular.js?body=1>)
at Scope.$apply
(http://localhost:3000/assets/angular.js?body=1:11833:24<http://localhost:3000/assets/angular.js?body=1>)
at
http://localhost:3000/assets/angular.js?body=1:1298:15<http://localhost:3000/assets/angular.js?body=1>at
Object.invoke (
http://localhost:3000/assets/angular.js?body=1:3679:17<http://localhost:3000/assets/angular.js?body=1>)
at doBootstrap
(http://localhost:3000/assets/angular.js?body=1:1296:14<http://localhost:3000/assets/angular.js?body=1>)
at bootstrap
(http://localhost:3000/assets/angular.js?body=1:1310:12<http://localhost:3000/assets/angular.js?body=1>)
at angularInit
(http://localhost:3000/assets/angular.js?body=1:1259:5<http://localhost:3000/assets/angular.js?body=1>)
at
http://localhost:3000/assets/angular.js?body=1:20365:5<http://localhost:3000/assets/angular.js?body=1>
On Saturday, January 4, 2014 12:45:07 PM UTC-5, Sander Elias wrote:
>
> Hi Steven,
>
> Oh sorry, I was not very clear on that. Put it in your controller, on the
> place you now have:
>
> $scope.todos = Todo.query()
>
> replace that with the code I gave you earlier on, and share the result of
> that!
>
> Regards
> Sander
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.