Skip to content

Instantly share code, notes, and snippets.

@froots froots/app.js
Created Feb 23, 2011

Embed
What would you like to do?
Simple test case demonstrating issue 228 for documentcloud/backbone
var AppView = Backbone.View.extend({
display: function(text) {
$('#app').text(text);
}
});
var AppController = Backbone.Controller.extend({
initialize: function() {
this.view = new AppView();
},
routes: {
"": "index",
"foo": "foo"
},
index: function() {
this.view.display("index");
},
foo: function() {
this.view.display("foo");
}
});
var controller = new AppController();
Backbone.history.start();
<!doctype html>
<html>
<ul>
<li><a href="#">Index route</a></li>
<li><a href="#foo">Foo route - doesn't work on IE7</a></li>
</ul>
<div id="app"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"></script>
<script src="http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"></script>
<script src="app.js"></script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.