title: Angular - extending $resource subobject with custom methods
body: <p>In most cases the result of <code>&lt;custom-resource&gt;.query()</code> method is an array, which can be easily extended with some methods (business logics) with the following (factory) code:</p>
  
  <pre><code>var Data = $resource('http://..');
  Data.prototype.foo = function() {return ...};
  </code></pre>
  
  <p>this is perfect for using with ng-repeat / ng-class, like so:</p>
  
  <pre><code>&lt;tr ng-repeat="item in responseData" ng-class="{warning: item.foo()}"&gt;..&lt;/tr&gt;
  </code></pre>
  
  <p>My problem is that <strong>every list response is encapsulated</strong> in an object which, besides the actual list, has some meta-properties (sorting info etc), so the final object returned is like this:</p>
  
  <pre><code>{ order_field: "name", items: [{..}, {..},{..}] }
  </code></pre>
  
  <p>Now, how do I make the same thing as previously with ng-repeat/ng-class?</p>
  
  <pre><code>&lt;tr ng-repeat="item in responseData.items" ng-class="????"&gt;..&lt;/tr&gt;
  </code></pre>
  
  <p>the previous method won't work as the "foo" method is defined on <code>responseData</code> and NOT on <code>item</code> object </p>
  
  <p>Is there any way to directly extend the base class used for instantiating objects on the list?</p>
  
  <p>Thanks!</p>