我正在尝试使用backbone.js 和bootstrap.js 创建一个简单的页面。我无法理解如何使用backbone.js 的视图,因此我将我的整个模型集合表示为引导程序中的列表。我尝试在网上搜索很多文章,但找不到我能理解的简单内容。您能否建议一些有关如何执行以下操作的博客或文章:
<html>
<body>
<script>
Boys = Backbone.Model.extend({
defaults : {
Name : '',
Age : ''
}
});
GardeA = Backbone.Collection.extend({
model : Boys,
url : http://localhost:8080/getGradeAData,
});
GradeAView = Backbone.View.extend({
el: '.container .span12',
initialize: function(){
gradeA = new GardeA();
gradeA.fetch();
this.render();
},
render: function(){
//How can I assign the model collection here
//directly to render in the below bootstrap html page can you please help
this.$el.html('List of students');
}
});
gradeAView = new GradeAView();
</script>
<div class="container">
<div class="hero-unit">Loading</div>
<div class="row">
<div class="span12">
<h3>Projects: </h3>
<ul class="nav nav-tabs nav-stacked">
<!-- need to show list of students here-->
</ul>
</div>
</div>
</div>
</body>
</html>