diff --git a/labs/dependency-examples/durandal/js/viewmodels/list.js b/labs/dependency-examples/durandal/js/viewmodels/list.js index 2a7df8d35b..10b0f6e084 100644 --- a/labs/dependency-examples/durandal/js/viewmodels/list.js +++ b/labs/dependency-examples/durandal/js/viewmodels/list.js @@ -10,6 +10,7 @@ define([ var Todo = function (title, completed) { this.title = ko.observable(title); this.completed = ko.observable(completed); + this.editTitle = ko.observable(title) //we use this as a shadow for the title so that if the user exits without saving, it is not persisted. this.editing = ko.observable(false); }; @@ -91,7 +92,7 @@ define([ item.editing(false); //trim and save back - var trimmed = item.title().trim(); + var trimmed = item.editTitle().trim(); item.title(trimmed); if (!trimmed) { diff --git a/labs/dependency-examples/durandal/js/views/list.html b/labs/dependency-examples/durandal/js/views/list.html index bc7a493cd4..84c4d6c937 100644 --- a/labs/dependency-examples/durandal/js/views/list.html +++ b/labs/dependency-examples/durandal/js/views/list.html @@ -10,7 +10,7 @@ - +