工作採用NG-重複我在編輯表單顯示一些電臺的:無線電綁定的不是角
<label style="float: left;margin-right: 3px;" data-ng-repeat="gender in genders" data-ng-hide="$first">
<input type="radio" name="gender" value="{{gender.Id}}" data-ng-model="customerFormData.customer.Gender.Id" />{{gender.Description}}
</label>
正如你所看到的,我申請了「點實踐」。編輯表單是我的詳細信息表單上的一個彈出式窗口。在我的具體形式我有這樣的:
<tr>
<td>Gender:</td>
<td>{{ customer.Gender.Description }} </td>
</tr>
我所有的綁定在編輯形式工作,但我不能讓兩性的結合工作。我認爲這與通過使用ng-repeat繼承範圍有關。
我還試圖用$parent
,但結果是一樣的:
<label style="float: left;margin-right: 3px;" data-ng-repeat="gender in genders" data-ng-hide="$first">
<input type="radio" name="gender" value="{{gender.Id}}" data-ng-model="$parent.customerFormData.customer.Gender.Id" />{{gender.Description}}
</label>
設置初始價值的作品。選擇女性時,選擇女性收音機,選擇男性收音機。
第二個問題是(我認爲它與綁定有關),是當選擇男性時,我必須在女性上點擊兩次才能選擇女性。
編輯:我創建了一個Fiddle來說明我的問題。
你可以準備一個笨重的代碼? – callmekatootie
@callmekatootie我添加了一個小提琴。查看我更新的帖子 – Martijn