다음은 컬렉션에서 올바른 데이터를 가져 오기 위해 초기화 될 때 모듈 이름을 받아야하는 뷰의 제 초기화 함수입니다.collectionTo에 대한 listenTo는 콜렉션을 가져온 후에 호출되지 않습니다.
문제는 다음과 같습니다 컬렉션이 인출 된 후
- Listento이 렌더링() 메소드로 리디렉션하지 않습니다, 또한 나에게 콘솔
TypeError: e is undefined
에 오류가 있습니다 아래 코드로 실수 한 것은 무엇입니까 ??
initialize: function() {
var that = this;
if(this.options.module === 'questions'){
require([
'app/collections/questions'
], function(QuestionsCollection){
var moduleCollection = new QuestionsCollection();
that.collection = moduleCollection;
moduleCollection.fetch({
reset: true,
success: function(){},
error: function(){}
});
});
}
this.listenTo(this.collection, 'reset', this.render);
this.listenTo(Backbone, 'close:Home', this.close);
},
나는 당신의 분석에 문제가 있다고 확신하지만 이런 상황에서 어떻게 할 것을 제안 하는가? 나는이 해결책을 사용하여 요청에 의해서만 서버로부터로드 된 파일의 수를 줄였다. – ahmedsaber111