Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Created August 19, 2012 16:53
Show Gist options
  • Save bjartwolf/3396220 to your computer and use it in GitHub Desktop.
Save bjartwolf/3396220 to your computer and use it in GitHub Desktop.
buster 201 src
function AppViewModel() {
var self = this;
self.firstName = ko.observable("Bert");
self.lastName = ko.observable("Bertington");
self.fullName = ko.computed(function () {
return self.firstName() + " " + self.lastName();
}, self);
self.capitalizeLastName = function () {
var currentVal = self.lastName(); // Read the current value
self.lastName(currentVal.toUpperCase()); // Write back a modified value
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment