Kolekcja widoku działa tylko w pliku console.log
Przykro mi z powodu niejasnego tytułu, nie jestem pewien, co jest wystarczające, aby lepiej to sformułować.
Więc to jest render według mnie:
render: function () {
var that = this;
var template = JST['gists/index'];
that.$el.html(template);
console.log(['index to render', that.collection]);
_.each(that.collection, function (gist) { // <- I set a breakpoint here
console.log('looping');
that.appendGistDetail(gist);
});
return that;
},
`Console.log (..., that.collection]) poprawnie rejestruje tę kolekcję:
["index to render", child]
0: "index to render"
1: child
_byId: Object
length: 1
models: Array[1] // <- Note one element. Saving space, but I checked it out and the model is correct
// Worth noting 'looping' is not being logged
Jednak dane wyjściowe wspomnianego wcześniej punktu przerwania Scope Variable są wyświetlane w narzędziach Dev Dev:
that: child
$el: jQuery.fn.jQuery.init[1]
childViews: Array[0]
cid: "view2"
collection: child
_byId: Object
length: 0
models: Array[0] // <- Note it's empty, just to test I also set a bp on the line above and it's the same, and when I hovered my mouse over `that.collection` from `console.log` it also said it was empty, but it logs correctly.
Więc nie jestem pewien, co robić, a nawet co się dzieje.