Created
February 5, 2015 07:06
-
-
Save cambiata/8e10dd8f5b0d7df9713d to your computer and use it in GitHub Desktop.
Mithril-question 2
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 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