1
所以我跟着sproutcore "getting started" guide,開始徘徊,看看我能否做到我的意思。在這裏,我witht這個模板,它表示的文件輸入列表:如何獲取TemplateCollectionView中的索引?
{{#collection SC.TemplateCollectionView
contentBinding="Upload.uploadListController"}}
<label>{{content.title}}</label><input type="file" name="upload[]"/>
{/collection}}
尼斯。現在我想要從標籤for
屬性中獲益,以指向相應的輸入。所以基本上,我想輸出這樣的東西:
<label for="upload-0">Some label</label>
<input id="upload-0" type="file" name="upload[]"/>
<label for="upload-1">Some otherlabel</label>
<input id="upload-1" type="file" name="upload[]"/>
<!-- you get it -->
我該怎麼做?我在using handlebars page和sproutcore documentation on SC.ArrayController
上都找不到答案我在找錯地方?我是否試圖做一些我應該以另一種方式做的事情,更多萌芽的方式?
我試過了,但是sproutcore用span標籤包裝了帶有{{content.id}}的輸出。我怎樣才能防止這一點? – greg0ire
如果要綁定到屬性,則應該使用'{{bindAttr for =「content-id」}}「。 – Steffen
工程就像一個魅力。公認! – greg0ire