ember.js - Iterating Through a Tree of Ember-Data async Records -


i'm trying iterate through tree of ember-data async records. function crash of line 5 when children[i] has no children. how verify if children exist in children[i]? or provide better iterating function?

traverse: function(scslink) {   console.log(scslink.id);   scslink.get('children').then(children => {     for(var in children) {       children[i].get('children').then(_children => {         this.traverse(children[i]);       });     }   }); }, 

i able iterate through tree function:

traverse: function(scslink) {   console.log(scslink.id);   this.get('scslinkarr').pushobject(scslink)   scslink.get('children').then(children => {     children.foreach((child,index) => {       this.traverse(child);     });   }); }, 

Comments

Popular posts from this blog

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -