How do you replace a given index in an observableArray with another element.
I have:
ViewModel.Elements()[index]
how can i replace it with anot
observableArrays do have a replace
method. This takes in the old item and the new item.
So, you would call it like:
ViewModel.Elements.replace(ViewModel.Elements()[index], yourNewElement);
Internally, this just sets that index to your new item and calls valueHasMutated() to notify any potential subscribers.