Skip to content

Instantly share code, notes, and snippets.

@maccman
Forked from kirbysayshi/app.js
Created April 23, 2011 06:34
Show Gist options
  • Save maccman/938403 to your computer and use it in GitHub Desktop.
Save maccman/938403 to your computer and use it in GitHub Desktop.
troubleshooting spine.js
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="../spine.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/spine.route.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function(){
var App = Spine.Controller.create({
el: $("body")
,elements: {
"#home": "$home"
,"#step-1": "$step1"
,"#step-2": "$step2"
,"#step-3": "$step3"
}
,events: {
"click .nextStep": "nextStep"
}
,init: function(){
this.routes({
"/step/:num": function(num){
console.log("step", num)
}
,"/home": function(){
console.log("home")
}
});
console.log("App init");
this.navigate("/other");
}
});
// sets up initial routing
Spine.Route.setup();
App.init();
});
</script>
</head>
<body>
<a href="#/step/1">/step/1</a>
<a href="#/home">/home</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment