What is the correct way to create a nested model where the model contains a property which contains a list of object of the same model?
For example
export const Person = can.Map.extend({
define: {
mother: {
Type: Person
},
father: {
Type: Person
},
children: {
Type: Person.List
}
}
});
Person.List = can.List.extend({
Map: Person
});
Obviously that does not work because Product.List has not been defined yet. I tried creating the list first and then attaching the map afterwards, but that doesn’t work either
Person.List = can.List.extend({});
export const Person = can.Map.extend({
define: {
mother: {
Type: Person
},
father: {
Type: Person
},
children: {
Type: PersonList
}
}
});
PersonList.Map = Person;
Person.List = PersonList;
The Map property doesn’t seem to take effect after the fact.