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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -