-
-
Save ciscoheat/0b32595be097680a0ddb to your computer and use it in GitHub Desktop.
Using a View instead of a Module
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
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