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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -