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

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -