Shane Shane - 1 year ago 82
AngularJS Question

ng-model not getting updated in radio button

Below is my code, the radio button gets checked

but the
is not updated. I have to select it again to

<li ng-repeat="method in data">
<input ng-model="session.payment" ng-checked=" === 'ACTIVE'" type="radio" value="{{method.paymentId}}">
<span class="radio-btn"></span>

Answer Source

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 = === 'ACTIVE';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download