title: how to map many to many relation in angularjs
body: <p>Hello my problem is simple but I lost whole day and I can't find the solution</p>
  
  <p>I have JAVA objects</p>
  
  <pre><code>class Phone {
       public int id;
       public String name;
       public List&lt;Accessory&gt; accessories;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Accessory {
      public int id;
      public String name;
      public List&lt;Phone&gt; phones;
  }
  </code></pre>
  
  <p>how should I map this in js ? I can't find any reference to creating maping of relation between objects</p>
  
  <p>if I manualy create something like this</p>
  
  <pre><code>name: nokia,
  accesories: {
  id:1, name: head,
  id:2, name: keys
  }
  </code></pre>
  
  <p>i won't get relation i'll just get a big model </p>
  
  <p>// edit </p>
  
  <pre><code>function MyCtrl($scope) {
          $scope.Phone = {Id: 1, Name:'Nokia'};
          $scope.Phone.Accessories = [{Id:1, Name:'foo'}, {Id:2, Name:'bar'}, {Id:3, Name:'barfoo'}];
      }
  </code></pre>
  
  <p>this is code from your url. But this ain't close enough</p>
  
  <p>I would like to have something like this</p>
  
  <pre><code>$scope.Phones = [{Id: 1, Name:'Nokia'}, {Id: 2, Name:'Samsung'}, {Id: 3, Name:'iPhone'}];
  </code></pre>
  
  <p>But I don't know how to bind accessories to each of the phones</p>