how to use http.post in angular js to retrieve rows from my checked data table?

0

I have a data table with id, name, etc. and have checkboxes added within the Angular

for example.

vm.dtColumns = [
                    DTColumnBuilder.newColumn(null).withTitle(titleHtml).notSortable()
                    .renderWith(function(data, type, full, meta) {
                        vm.selected[full.ID] = false;
                        return '<input type="checkbox" class="checkedtestids" ng-model="showCase.selected[' + data.ID + ']" ng-click="showCase.toggleOne(showCase.selected)">';
                    }),

I have checkboxes that can select all header rows or individually.

I also have a var that holds the id and changes the boolean state from true to false depending on whether the check box is checked or not.

var vm = this;
    vm.message = '';
    vm.someClickHandler = someClickHandler;
    vm.selected = {};
    vm.selectAll = false;
    vm.toggleAll = toggleAll;
    vm.toggleOne = toggleOne;

My HTML code to display this vm.selected = {}; is as follows:

<div ng-controller="WithAjaxCtrl as showCase">

   <blockquote>Please click on a row</blockquote>
   <p class="text-danger">
     You clicked on: <strong>{{ showCase.message }}</strong>
   </p>

   <table datatable="" dt-options="showCase.dtOptions"
                dt-columns="showCase.dtColumns" class="row-border hover"></table>


   <p class="text-danger">You selected the following rows:</p>
   <p>**<pre ng-model="showCase.selected">{{ showCase.selected |json }}</pre**>

If I click on these ids:

Then the following is reflected below:

{
  "2457937718692": true,
  "2457985718634": false,
  "2454757950532": true,

How do I send this array vm.selected which indicates checked or not to my Java spring controller which then use them for another purpose? I tried to use $http.post() and $http.get() to no avail.

    
asked by anonymous 22.03.2018 / 05:20

0 answers