0

I want if checkbox selected and click submit button insert data to database.

<tbody>
  <tr ng-repeat="item in rows | filter:search">
    <td>{{ite m.isbn}}</td>
    <td>{{item.kitap_ismi}}</td>
    <td>{{item.sayfa_sayisi}}</td>
    <td>{{item.baski_yili}}</td>
    <td>{{item.isim}}</td>
    <td>{{item.kategori_isim}}</td>
    <td>{{item.yayinevi_isim}}</td>                     
    <td><center><input type="checkbox"></center></td>
  </tr>
</tbody>                        

<input type="submit" name="submit" value="Submit" class="btn btn-success">
2
  • Please check this: stackoverflow.com/questions/20968170/… Commented Dec 19, 2015 at 21:07
  • its not help. click button selectedrow insert database or json Commented Dec 19, 2015 at 21:23

1 Answer 1

0

Here you have working fiddle

I'm adding '_metaSelected' property to every row on selection:

<input type="checkbox", ng-model="item._metaSelected">

And on submit:

<input type="submit" name="submit" value="Submit" ng-click="submit()">

Sending only items with '_metaSelected' property:

$scope.submit = function(){
  //- Clear
  $scope.submitedRows = [];

  //- Choose selected rows
  angular.forEach($scope.rows, function(row){
    if(row._metaSelected){
      //- Remove _metaSelected property before submition
      delete row['_metaSelected'];

      $scope.submitedRows.push(row);    
    }
  });
  //- POST with submitedRows as payload
  //- yourService.save($scope.submitedRows)
}       
Sign up to request clarification or add additional context in comments.

9 Comments

Thank you. i need to give the date when the user presses the button
Date? You mean 'data'. And in attached fiddle I'm handling click action. You have to place there your own service with POST method to your server.
Thank you man. so sorry but i dont understand how insert submitedRows data to db
I what programming language is your backend?
my database postgresql language php
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.