Router = Backbone.Router.extend({
routes: {
'': 'index',
'hoge': 'hoge',
'*hash': 'default'
},
default: function(hash) {
console.debug('default', hash);
},
index: function() {
console.debug('index');
},
hoge: function() {
console.debug('hoge');
}
});
$(document).ready(function() {
window.router = window.router || new Router();
Backbone.history.start();
});
More than 5 years have passed since last update.
Backbone.jsのRouterで規定のハッシュにマッチしなかった場合をハンドリングする
Last updated at Posted at 2013-05-27
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme