Skip to content

Instantly share code, notes, and snippets.

@frozzare
Created March 18, 2013 21:41
Show Gist options
  • Select an option

  • Save frozzare/5191070 to your computer and use it in GitHub Desktop.

Select an option

Save frozzare/5191070 to your computer and use it in GitHub Desktop.
<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>
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