strongloop/loopback-angular — pull request #29 by bajtos (2014-04-03 09:51:02+00:00)
Title: Access models related via hasAndBelongsToMany

The relation "Product hasAndBelongsToMany Category" creates a scope
property on the Product model with three methods: get, create, delete.

At the Angular side, these methods are defined on the Product $resource,
therefore they return the result as Product instead of Category.

The solution presented in this patch has two main parts:

1. The Category $resource has internal methods calling remote (REST)
Product.categories.* methods. This way the result is returned
as Category.

2. The Product $resource has extra properties (methods) with hand-coded
implementation delegating to the internal Category methods.

Methods & delegations:
* `Product.categories() -> Category['::get::Product::categories']()`

* `Product.categories.create() -> Category['::create::Product::categories']()`

* `Product.categories.destroyAll() -> Category['::delete::Product::categories']()`

/to @ritch please review.

Closes #26.
Depends on strongloop/loopback#223 and strongloop/loopback-datasource-juggler#96.
Related: strongloop/loopback-datasource-juggler#97