codeschool.comバックボーンコースのレベル7には、以下のコードがあり、次のjqueryですべてを開始できると述べています。
$(function(){ TodoApp.start() })
を呼び出しますBackbone.history.start
。しかし、への呼び出しは、モデルコレクションにデータを入力するために呼び出されるように、Backbone.history.start
最終的にどのように呼び出されることになりますか。index
fetch
todoList
var TodoApp = new (Backbone.Router.extend({
routes: { "": "index", "todos/:id": "show" },
initialize: function() {
this.todoList = new TodoList();
this.todosView = new TodoListView({collection: this.todoList});
$('#app').append(this.todosView.el);
},
start: function(){
Backbone.history.start({pushState: true});
},
index: function(){
this.todoList.fetch();
},
show: function(id){
this.todoList.focusOnTodoItem(id);
}
}));