javascript - Angular to check a particular checkbox automatically -
i have form few checkboxes , form being processed via angularjs. have no knowledge angular read find solution problem. want checkbox checked automatically when form load. when @ codes below don't understand need help.
html: (i think dynamically generates few < li > options in form gui)
<ul class="sublist" style="padding-top:{{ $index * 38}}px;" ng-init="index=$index" ng-if="foractive == k" ng-repeat="(k, v) in fordata"> <li class="selected" ng-repeat="val in v"> <a href="" title="">{{ val }} </a> <input value="{{ k }} > {{ val }}" type="checkbox" class="flc" ng-click="addforvalue(k + ' > ' + val)" /> </li> </ul>
content of array in angular: $scope.design.fors = [adults > men,adults > plus]
for example, when form load, checkbox value = adults > men shall checked.
thanks in advance
the way handle making object little more rich:
$scope.design.fors = [ { value: "adults > men", checked: true}, { value: "adults > plus", checked: false}]
then in view can write like:
<ul class="sublist"> <li class="selected" ng-repeat="item in design.fors"> <input type="checkbox" ng-model="item.checked" /> {{item.value}} </li> </ul>
Comments
Post a Comment