knockout.js - concatenating a string to $index in foreach loop knockoutjs -


this connected answer this question

the following works..http://jsfiddle.net/vt6v6l9u/2/

<div data-bind="foreach: retrievedusers" >     <div>         <label data-bind="attr:{for:$index}"> 

i need concatenate string $index.. http://jsfiddle.net/vt6v6l9u/4/

<div data-bind="foreach: retrievedusers" >     <div>         <label data-bind="attr:{for:'const' + $index}"> 

the fiddle seems work if inspect radio button element.. find..

<label data-bind="attr:{for:'const' + $index}" for="constfunction c(){if(0<arguments.length)return c.equalitycomparer&amp;&amp;c.equalitycomparer(d,arguments[0])||(c.o(),d=arguments[0],c.n()),this;a.i.lb(c);return d}"> 

any sincerely appreciated

thanks

$index observable , must evaluated:

<div data-bind="foreach: retrievedusers" >     <div>         <label data-bind="attr:{for:'const' + $index()}"> 

(note parens)

updated fiddle: http://jsfiddle.net/vt6v6l9u/5/


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -