Backbone.js kullanarak basit bir RSS uygulaması geliştirmeye çalışıyorum. Bu backbone.js tutorial kullanıyorum. Şablonu tanımlarken, satır 2'de (şablon) aşağıdaki hatayı alıyorum. Birisi de bana neden TagName olduğunu öğretebilir: "li" öğreticide tanımlı?yakalanmamış TypeError: undefined backbone.js 'replace' yöntemini çağırın.
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();
}
});
HTML
<script type="text/template" id="tmpl_sourcelist">
<div id="source">
<a href='#Source/<%=id%>'<%=name%></a>
</div>
</script>
sayesinde Haklısınız buradan hata alıyorsanız
Şablonu verileri kullanmadan çalıştırmayı deneyin ve ne aldığınızı görün ... bu. $ El.html (this.template()) – beNerd
Bu satır2'de hata veriyor (şablon: _.template ($ ('# tmpl_sourcelist')) biçimini())). Ne tavsiye edeceğinizden emin değilsiniz. – jsp