Skip to content

Instantly share code, notes, and snippets.

@ciscoheat
Forked from cambiata/Example.hx
Last active August 29, 2015 14:14
Show Gist options
  • Save ciscoheat/0b32595be097680a0ddb to your computer and use it in GitHub Desktop.
Save ciscoheat/0b32595be097680a0ddb to your computer and use it in GitHub Desktop.
Using a View instead of a Module
class User implements Model {
@prop public var name : String;
public function new(name) {
this.name = M.prop(name);
}
}
class TestModule implements View {
var user:User;
public function new() {
this.user = new User('Nisse Hult');
}
public function view() {
m('div', [
m("input", {
oninput: M.withAttr("value", this.user.name),
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