title: Correct pattern using Angular $resource to get related data
body: <p>I understood that the concept of $resource in AngularJS is to return</p>
  
  <ul>
  <li>A resource, an object representing this resource (get, update, delete)</li>
  <li>A list of objects representing this resource (query)</li>
  </ul>
  
  <p>I am using a backend which does not provide all needed information in one shot.</p>
  
  <p>For example: <code>/User/:id</code></p>
  
  <p><code>user = User.get({id: userId});</code> returns a User. Great.</p>
  
  <p>If I need to get the number of his friends, I have another request wich will be like:</p>
  
  <p><code>/User/:id/count=friend</code></p>
  
  <p>And return:</p>
  
  <p><code>{ count: 17 }</code></p>
  
  <p>Here I am stuck, I can't use my <code>user</code> variable, or I will lose my user object. Plus the result will be a number, which does not represent my user anymore.</p>
  
  <p>The 'dirty' way would be to go back with <code>$http</code> for this and to assign the result to <code>user.friendsNumber = data.count</code>.</p>
  
  <p>But still not clean, if I <code>user.$put()</code> something, I lose my <code>user.friendsNumber</code> as it will be reassigned.</p>
  
  <p>What is the correct way to handle this properly?</p>