我想將以下select
,option
標籤更改爲ul
,li
。將angular2選擇/選項更改爲ul/li綁定到選項
<select [(ngModel)]="selectedLanguage" name="selectedLanguage">
<option *ngFor="let lang of languages" [value]="lang">{{lang}}</option>
</select>
理想情況下是bootrap友好,如:
<ul class="dropdown-menu">
<li>...</li>
</ul>
有人可以幫助嗎? 感謝
編輯: 如果我只是改變了li
select
爲ul
和option
我得到
error_handler.js:49ORIGINAL EXCEPTION: No value accessor for form control with name: 'selectedLanguage'
我猜[value]
標籤不上li
有效的,但我不是很確定如何修復它
我需要[(ngModel)]="selectedLanguage"
更新爲選定的li
有什麼問題? –