1
그래서 나는 sproutcore "getting started" guide을 따라 갔고, 내가 쉽게 의미있는 것을 할 수 있는지보기 위해 길을 떠나기 시작했습니다. 여기에 파일 입력 목록을 나타내는이 템플릿이 없습니다.TemplateCollectionView에서 인덱스를 가져 오는 방법은 무엇입니까?
{{#collection SC.TemplateCollectionView
contentBinding="Upload.uploadListController"}}
<label>{{content.title}}</label><input type="file" name="upload[]"/>
{/collection}}
Nice. 이제 내가하고 싶은 것은 레이블 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는'{{content.id}}'의 출력을 span 태그로 래핑합니다. 이 문제를 어떻게 방지 할 수 있습니까? – greg0ire
속성에 바인딩하려면 '{{bindAttr for = "content-id"}}'를 사용해야합니다. – Steffen
매력처럼 작동합니다. 수락 됨! – greg0ire