की विधि 'प्रतिस्थापन' को कॉल नहीं कर सकता है, मैं backbone.js का उपयोग करके एक साधारण आरएसएस ऐप विकसित करने की कोशिश कर रहा हूं। मैं इस backbone.js tutorial का उपयोग कर रहा हूँ। टेम्पलेट को परिभाषित करते समय, मुझे लाइन 2 (टेम्पलेट) पर निम्न त्रुटि मिल रही है। क्या कोई मुझे बता सकता है कि टैगनाम क्यों है: "li" ट्यूटोरियल में परिभाषित किया गया है?uncaught TypeError: अपरिभाषित backbone.js
uncaught TypeError: Cannot call method 'replace' of undefined backbone.js
Javscript
window.SourceListView = Backbone.View.extend({
tagName:"li",
template: _.template($('#tmpl_sourcelist').html()),
initialize:function() {
this.model.bind("change", this.render, this);
this.model.bind("destroy", this.close, this);
},
render:function (eventName) {
$(this.$el).html(this.template(this.model.toJSON()));
return this;
},
close:function() {
$(this.el).unbind();
$(this.el).remove();
}
});
एचटीएमएल
<script type="text/template" id="tmpl_sourcelist">
<div id="source">
<a href='#Source/<%=id%>'<%=name%></a>
</div>
</script>
धन्यवाद
डेटा के बिना टेम्पलेट को चलाने का प्रयास करें और देखें कि आपको क्या मिलता है ... यह $ el.html (this.template()) – beNerd
यह लाइन 2 पर त्रुटियों (टेम्पलेट: _.template ($ ('# tmpl_sourcelist') .html()),)। सुनिश्चित नहीं है कि आप क्या सिफारिश कर रहे हैं। – jsp