Reputation: 5677
Below is my code, the radio button gets checked onload
but the ng-model
value session.payment
is not updated. I have to select it again to update
.
<li ng-repeat="method in data">
<label>
<input ng-model="session.payment" ng-checked="method.active === 'ACTIVE'"
type="radio" value="{{method.paymentId}}">
<span class="radio-btn"></span>
</label>
</li>
Upvotes: 1
Views: 640
Reputation: 3777
You should not use ng-checked alongside ng-model. Rather than setting the ng-checked directive onLoad, just set the session.payment variable in your controller.
So now you should have your HTML as:
<input ng-model="session.payment" type="radio" value="{{method.paymentId}}">
And in your controller:
$scope.session.payment = method.active === 'ACTIVE';
Upvotes: 4