我使用後在我的應用程序代碼:AngularJS預輸入 - 顯示也版本的複選框,文件的選擇
<input type="text"
class="form-control"
placeholder="Search document"
data-ng-model="file"
typeahead="document as document.fileName for document in vm.findDocumentsByTerm($viewValue)"
typeahead-min-length="2"
typeahead-wait-ms="100"
typeahead-editable="false"
typeahead-on-select="vm.attachFile(file)" />
,我不僅會顯示文件名(document.fileName),但文件也版本(document.versions),它是一個數組和一個複選框,以便選擇文檔的一個版本。 有沒有可能做到這一點?
[編輯] 感謝yeslcan,這正是我所需要的。目前,它看起來像這樣:
,這是我的html代碼:
<input type="text"
class="form-control"
data-ng-model="file"
typeahead="document as document.fileName for document in vm.findDocumentsByTerm($viewValue)"
typeahead-template-url = "sampleTemplate.htm" />
<script type="text/ng-template" id="sampleTemplate.htm">
<div>
<table class="table">
<tr data-ng-click="$event.stopPropagation()">
<td>{{match.model.fileName}}</b></td>
<td>
<div data-ng-repeat="documentFileVersion in match.model.documentFileVersions">
<input type="checkbox" data-ng-model="vm.documentFileVersion" data-ng-click="vm.addDocumentFile(vm.documentFileVersion)" /> {{documentFileVersion.version}}
</div>
</td>
</tr>
</table>
</div>
</script>
目前功能vm.addDocumentFile(vm.documentFileVersion)不會被調用。有沒有人知道我必須做什麼才能調用這個函數?
我不明白你的問題,請澄清 –
與發佈代碼僅在文檔的文件名顯示在下拉菜單中,我的問題是,如果有可能顯示文件名和相應版本(vers離子是一個文件的浪花) – quma
你的意思是每個文件應該有一個選項可用於該文件的每個版本? – user125661