Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example use case demonstrating complex object change tracking at multiple levels
var viewModel = {
Name: ko.observable("Pete"),
Age: ko.observable(29),
Skills: ko.observable({
Tdd: ko.observable(true),
Knockout: ko.observable(true),
ChangeTracking: ko.observable(false),
Languages: ko.observable({
Csharp: ko.observable(false),
Javascript: ko.observable(false)
}),
}),
Occupation: ko.observable("Developer")
};
applyChangeTracking(viewModel);
viewModel.Skills().ChangeTracking(true);
viewModel.Skills().Languages({
Csharp: ko.observable(true),
Javascript: ko.observable(true),
});
getChangesFromModel(viewModel);
/* -> {
"Skills": {
ChangeTracking: true,
Languages: {
Csharp: true,
Javascript: true
}
}
} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.