<input type="radio" ng-checked="pooledFunds.acceptPooledFunds == 1">
<input type="radio" ng-checked="pooledFunds.acceptPooledFunds == 1"> {{pooledFunds.acceptPooledFunds}} , {{pooledFunds.acceptPooledFunds == 1}}
and I have a JSON object assigned to scope variable in my controller like
$scope.pooledFunds = {"acceptPooledFunds" : 1};
The value pooledFunds.acceptPooledFunds when printed using {{pooledFunds.acceptPooledFunds}} shows 1 and {{pooledFunds.acceptPooledFunds == 1}} shows true.
But the radio button is not turning into checked mode. I have already checked this link : angular ng-checked is not working for radio
and it was not helpful.
Try this
<input type="radio" ng-model="pooledFunds.selectedVal" name="pooled" />
<input type="radio" ng-model="pooledFunds.selectedVal" name="pooled" />
Javascript
$scope.pooledFunds.selectedVal = 1;
Use ng-model
and if you set value of your model to true/false then it should work.
Working Demo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.