I'm trying to iterate through a tree of Ember-Data async records. The function crash of line 5 when children[i] has no children. How could I verify if children exist in children[i]? Or could you provide a better iterating function?
traverse: function(scsLink) {
console.log(scsLink.id);
scsLink.get('children').then(children => {
for(var i in children) {
children[i].get('children').then(_children => {
this.traverse(children[i]);
});
}
});
},
Aucun commentaire:
Enregistrer un commentaire