javascript - CanJs - Iterate through an array in mustache and create observables -


    ...       option:{   array: new can.list([1, 2, 3, 4, 5]) }     ...  {{#each option.array}}   <div>     <label for="d{{@index}}"></label>     <input id="d{{@index}}" can-value="option.array[{{@index}}]"/>   </div> {{/each}} 

above code generates 5 text boxes correct id. not create observables.

what correct format should provide can-value attribute make observable?

quoting part of sections/iteration documentation:

the {{.}} tag reference current item within array during iteration (which used when items in array primitives strings , numbers).

it seems want like:

<input id="d{{@index}}" can-value="{{.}}"/> 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -