eugene007
asked on
Multiple Checkbox value to controller
In each bootstrap collapse expand panel I have a table with two columns and multiple rows created. Each row has a checkbox.
Now when I press Update Permission button, I intend to send two values to my angularjs controller namely perm.id and value.id for each row to process.
How can I go about with this. Your help is kindly appreciated.
Thank You.
Now when I press Update Permission button, I intend to send two values to my angularjs controller namely perm.id and value.id for each row to process.
<div class="col-xs-12">
<div class="row">
<div class="col-md-12 margin-tb">
<div class="pull-left">
<h1>Listing Module</h1>
</div>
<div class="pull-right">
<input type="button" ng-click="updPermission()" value="Update Permission">
</div>
</div>
</div>
<div ng-repeat="value in module">
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapseModule{{value.id}}">
<i class="glyphicon glyphicon-collapse-down"></i>{{value.name}}
</a>
</h4>
</div>
<div id="collapseModule{{value.id}}" class="panel-collapse in">
<div class="panel-body">
<table class="moduleGrid table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Permission</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<!-- Now just ng-repeat the rows -->
<tr ng-repeat="perm in value.permission">
<td>
{{perm.name}}
</td>
<td>
<input name="permStatus" type="checkbox" ng-model="ngModel" ng-checked={{perm.status}} ng-true-value="{{perm.id}}"/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<br/><br/><br/><br/><br/>
</div>
How can I go about with this. Your help is kindly appreciated.
Thank You.
ASKER
I replaced the following line of code
to
ng-click="checkItems(value.id,perm.id)"
to
ng-change="checkItems(value.id,perm.id)"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window
and in my angularjs controller I did this
Open in new window
Now I am trying to identify whether a checkbox is checked or unchecked.