问题
I have a list of radio buttons using ng-repeat. When I initially load the page and select on the last radio button, the button on it's side gets selected. This only happens for the first time, i.e. if I click on the last button a second time, it is selected correctly.
<input type="radio" name="rb" value="{{rbCollection.name}}" data-ng-click="open(name)" data-ng-model="Ctrl.selection">
回答1:
Check this so.
The problem is that ng-click fires before the ng-model code that updates the scope. If you change it to use ng-change, that will fix it. You also need to add ng-change to your text box to update the scope as the user types.
来源:https://stackoverflow.com/questions/35612352/incorrect-radio-button-getting-selected-for-ng-repeat-radio-buttons