Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Single Page Apps - Sammy + Mustache
<script src="Scripts/jquery-2.0.2.js"></script>
<script src="Scripts/mustache.js"></script>
<script src="Scripts/sammy-0.7.4.js"></script>
<script src="Scripts/sammy.mustache.js"></script>
<script>
var app = $.sammy(function() {
// include the plugin and alias mustache() to ms()
this.use('Mustache', 'ms');
// to see this you will need to go to
// yourpage#/hello/AName
this.get('#/hello/:name', function() {
// set local vars
this.title = 'Hello!'
this.name = this.params.name;
// render the template and pass it through mustache
this.partial('mytemplate.ms');
});
});
$(function() {
app.run()
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment