Skip to content

Instantly share code, notes, and snippets.

@cambiata
Created February 5, 2015 07:06
Show Gist options
  • Save cambiata/8e10dd8f5b0d7df9713d to your computer and use it in GitHub Desktop.
Save cambiata/8e10dd8f5b0d7df9713d to your computer and use it in GitHub Desktop.
Mithril-question 2
class User implements Model {
@prop public var name : String;
public function new(name) {
this.name = M.prop(name);
}
}
class TestModule implements Module<TestModule> {
var user:User;
public function new() {}
public function controller() {
this.user = new User('Nisse Hult');
}
public function view() {
m('div', [
m("input", {
onchange: M.withAttr("value", this.user.name),
}),
m('span', this.user.name()),
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment