Hi, i have a code that displays information from a json file to a table. I
want to be able to get the checked values and post them to a rest api in
JSOn format. I need help with getting the values and sending them back to
the backend. my html looks like this:
<table st-safe-src="rowCollection" st-table="displayCollection"
class="table" style="text-align:center; margin-top:20px; width:100%">
<thead>
<tr style="cursor:pointer">
<th st-sort="name">Service Name</th>
<th st-sort="action" colspan="5">Action</th>
</tr>
<tr>
<th>
<input st-search="name" placeholder="search service"
type="search" class="rounded" style="width:100%; font-weight:normal"/>
</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in displayCollection" class="tableRow">
<td style="width:800%; text-align:left; padding-left:15px"
title='{{row}}'>
{{row}}
</td>
<td style="width:30%">
<div>
<input
type = "checkbox" value ="{{row.name}}"
ng-checked='selection.indexOf(row.name) > -1"
ng-click="toggleSelection(row.name)" />
</div>
</td>
</tr>
</tbody>
</table>
and my .js looks like:
app.controller('Partial1Controller', function($scope,$http) {
$scope.message = "Microservices";
$http({
method: 'GET',
url: '/test'
})
.success(function(data,status,headers,config){
console.log(data);
$scope.rowCollection = data;
$scope.displayCollection = [].concat($scope.rowCollection);
})
$scope.toggleSelection = function toggleSelection(serviceName) {
var idx = $scope.selection.indexOf(serviceName);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.