Created
December 18, 2014 22:53
-
-
Save devdays/2d1d4befd9d6e97859a7 to your computer and use it in GitHub Desktop.
Single Page Apps - Sammy + Mustache
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
<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