The Rails way of designing HTTP endpoints (which is a RESTful style) isn’t particular to Rails. It’s quite common outside the Rails world. Because of this, it’s possible to use a higher level of abstraction than what $http gives us. The Angular module angular-resource provides such an abstraction.
What it will allow us to do is to write code like so:
|||$scope.customer = Customer.get(customer_id);|
Although there are no callbacks, this code is still asynchronous. Execution continues after the call; it doesn’t wait for the Ajax call to complete. This is because the object returned by Customer.get is a promise that, when resolved, will behave like a customer object, exposing the various fields from ...