Inside my viewmodel I have following code:
var self = this;
self.Name = ko.observable(data.Name);
var mapped = $.map(data.Addresses, function (item) { return new Address(item) });
self.AddressList = ko.observableArray(mapped);
self.dirtyFlag = new ko.DirtyFlag([self.Name, self.AddressList]);
I always get the dirty flag true due to AddressList
.
Is there a way to specify what value is not dirty or when to start monitoring for change?
Sounds like maybe something in your address is bound to a select
with the value
binding and it is writing a value on the initial binding. It will change numbers to strings. You could always choose to call reset
on the flag after applying bindings (call self.dirtyFlag.reset()