嘗試使用ng-repeat
<ul>
<li ng-repeat = "n in [1,2,3,4]>
<label id="{{'p'+ n }}"> {{n}} </label>
<label ng-model="{{'p'+ n }}"> {{n}} </label>
</li>
</ul>
第一個 「標籤」 的作品。它的「id」分配正確。但第二個「標籤」不起作用。
是因爲「ng-model」不能動態創建?
我試圖在ng-repeat
內使用<select ng-model ... ng-options ...>
。不能動態地創建這些「ng模型」,我被困在這裏。
以下是關於動態創建ng模型的一些提示: http://zh.efreedom.com/questions/13989453/how-to-give-value-dynamically-for-ng-model-in-angularjs – ForgetfulFellow
浙胡..請選擇幫助你的答案。 –