On page load i am checking if attestationStatus flag is approved i want to make check box checked , with below implementation its not working, Any idea what implemented wrong.
main.html
<div class="col-md-3">
<label class="radio-inline">
<input type="checkbox"
ng-model="aprv"
name="attestorFlag"
id="attestorFlag"
ng-value="'Y'"> I attest
</label>
</div>
main.js
if ($scope.attestorObj.attestationStatus === 'approved') {
$scope.aprv = 'Y';
}
You don't need ng-value
. Use only ng-model
and set the $scope.aprv
value to true
or false
.
<input type="checkbox" ng-model="aprv" name="attestorFlag" id="attestorFlag">
Controller:
if ($scope.attestorObj.attestationStatus === 'approved') {
$scope.aprv = true;
}
you could add the condition to your checkbox itself by adding the ng-checked. think this should work for you, hope this helps or gets you in the right direction
<div class="col-md-3">
<label class="radio-inline">
<input type="checkbox"
ng-checked="$scope.attestorObj.attestationStatus == 'approved'"
ng-model="aprv"
name="attestorFlag" id="attestorFlag"> I attest </label>
</div>
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.