backbone.js - Can't loop over backbone collection -


it seems can't loop through backbone collection. i've seen topic in several threads, none of solutions help.

render:function () {         this.$el.html(this.template(this.model.attributes));         var = this;           console.log(this.projects.models);         _.each(this.projects.models, function(model) { console.log(model); });          return this;     } 

from console shows array[2] expect see each model well. know i'm doing wrong here ?

to collection content array, use method tojson (e.g.: collection.tojson())

next, loop on entire collection, use each method on collection instances!

collection.each(function( model ) {     console.log(model) }); 

if don't show full collection, problem in how add items inside collection, not in looping logic.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -