Created
September 9, 2012 20:46
-
-
Save andrewrk/3687164 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<a href="/">home</a> | |
<a href="/create">create</a> | |
<script src="jquery-1.8.1.js"></script> | |
<script src="underscore.js"></script> | |
<script src="backbone.js"></script> | |
<script src="app.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MainRouter, Router; | |
MainRouter = Backbone.Router.extend({ | |
routes: { | |
"": "index", | |
"create": "create" | |
}, | |
index: function() { | |
console.log("index"); | |
}, | |
create: function() { | |
console.log("create"); | |
} | |
}); | |
jQuery(function() { | |
window.Router = Router = new MainRouter; | |
Backbone.history.start({pushState: true}); | |
jQuery("a").on('click', function(e) { | |
e.preventDefault(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment