I\'m trying to replace all of the contents of an item in an observableArray
with new content.
var oldLocation = ko.utils.arrayFirst(self.locations()
I'm not aware of a replace method in JavaScript for arrays, or in Knockout. Am I missing something?
If you want to use your second method, then you need to access locations as an observable:
self.locations()[self.locations.indexOf(location)] = new fizi.ko.models.location(value);
self.locations.valueHasMutated();
though you don't when using indexOf, as there is a Knockout version of that for observable arrays.