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