Hi i am using knockout observables in ObservableArray the object that is pushed inside the observableArray is something like following and i am making its 'value' property as observable:
{
'name': "aka[]",
'value': (value && value != "" ? ko.observable(value) : ko.observable(""))
}
I am using the foreach inside my HTML to draw the input elements to the number of object found in observableArray (akaList below)
<p data-bind="foreach: $root.akaList()">
<input title="Also Known As (AKA)" data-bind="attr:{ 'name' : $data.name, 'value': $data.value}" type="text"
required="required"/>
</p>
When i type in the input element something it doesn't update the object value inside observableArray. I found that foreach unwrap the observable array so thats why i can't see the updates in the array. So i tried doing it with $parent.akaList()[$index()].value and my HTML becomes like this:
<p data-bind="foreach: $root.akaList()">
<input title="Also Known As (AKA)" data-bind="attr:{ 'name' : $data.name, 'value': $parent.akaList()[$index()].value}" type="text"
required="required"/>
</p>
but its still not working can you please tell me what is wrong ?I can't use mapping plugin due to some restrictions in my project. I am trying to find other way. am i writing something in wrong syntax? Here is fiddle below as well: