mercredi 24 janvier 2018

Angularjs add checkbox 1 or 0 value to mysql with node js

I am new to Angular js and I want to try the following. I have an Object Array that come from Database. This is the url(example): http://localhost:3000/items/showAll I have yet implemented the Add, Edit, Update, Delete (Crud operation in backend with nodejs and express js and frontend with angularjs) but my problem is with the checkbox. I have in a table in my database a field "state", typ boolean default 0 (1 or 0 value). I have a list of items(for example 100) and want to select with a checkbox in ng-repeat one or more items and send the value(1) to my filed state in the database. My logic is: I need to bind a single item id with the checkbox, then add a value to the checkbox and if is checked send it to the database.

<input type="checkbox" ng-model="state" parse-int ng-true-value="'1'" ng-false-value="'0'" class="form-check-input" >



 [{"id":1,"name":"item1","state":0}]

What can I in my controller do?




Aucun commentaire:

Enregistrer un commentaire