Created
March 18, 2013 21:41
-
-
Save frozzare/5191070 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <p>First name: <input data-bind="value: firstName" /></p> | |
| <p>Last name: <input data-bind="value: lastName" /></p> | |
| <h2>Hello, <span data-bind="text: fullName"> </span>!</h2> |
This file contains hidden or 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
| function ViewModel() { | |
| this.firstName = ko.observable("Fredrik"); | |
| this.lastName = ko.observable("Forsmo"); | |
| this.fullName = ko.computed(function() { | |
| return this.firstName() + " " + this.lastName(); | |
| }, this); | |
| } | |
| ko.applyBindings(new ViewModel()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment