Skip to content

Instantly share code, notes, and snippets.

@HendrikRoth
Created May 23, 2015 22:52
Show Gist options
  • Save HendrikRoth/bd0dc34eab56165a094b to your computer and use it in GitHub Desktop.
Save HendrikRoth/bd0dc34eab56165a094b to your computer and use it in GitHub Desktop.
var Contacts = {
controller: function() {
var contacts = [{name: 'Peter'}]
var contact = contacts[m.route.param]
return {
contact: contact
}
},
view: function(controller) {
return m("div", controller.contact.name);
}
}
m.route.mode = "hash";
m.route(document.body, "/contacts/0", {
"/contacts/:contact": Contact
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment