Hey Kevin, this isn't about directives but about RESTful services and $resource. I started learning how to use AngularJS yesterday and all of the examples that I've found on it are confusing to me and seem to do it in different ways.
I've seen somebody do it by calling myModule.factory. I've seen an example on Stackoverflow that says all you need to do is something like var Todo = $resource('/api/1/todo/:id');. I'm not sure where I'm supposed to put this code. I want to be able to use the resource globally but I don't have access to $resource in the global namespace.
All I'm trying to do is make a simple blog that can interact with my backend. If you have this part of the book written I'd love to read it right now.
EDIT: I figured out how to do it I think. But I'd still love a more complete introduction to using Angular with a RESTful service.
Personally I found using $http less restrictive - there seem to be some edge cases where $resource behaves oddly. Ideally what you should be doing with REST calls is pushing them out to Angular Services (http://docs.angularjs.org/guide/dev_guide.services.creating_...) rather than making them directly in your controller.
I've seen somebody do it by calling myModule.factory. I've seen an example on Stackoverflow that says all you need to do is something like var Todo = $resource('/api/1/todo/:id');. I'm not sure where I'm supposed to put this code. I want to be able to use the resource globally but I don't have access to $resource in the global namespace.
All I'm trying to do is make a simple blog that can interact with my backend. If you have this part of the book written I'd love to read it right now.
EDIT: I figured out how to do it I think. But I'd still love a more complete introduction to using Angular with a RESTful service.