mercredi 3 février 2016

Angularjs, ng-click, how put array of checkbox in MondoDB

Form with name and checkbox.

I can put the name in MongoDB, but , how can put the value of checkbox in the MongoDB?

Index.html

<tr>
  <td><input class="form-control" ng-model="film.name"></td> 
  <td><label ng-repeat="role in roles">

   <input type="checkbox" checklist-model="user.roles" checklist-value="role"> {{role}}
 </label></td>

  <td><button class="btn btn-primary" ng-click="addFilm()">Add manga</button></td>
</tr>

Collection films

db.films.insert({aome:" lara croft", gender:['action', 'adventure'] })

Function addFilm

$scope.addManga = function() {
       $http.post('/films', $scope.film).success(function(response) {
         })};


$scope.roles = [
    'adventure',
    'action'
  ];

  $scope.user = {
    roles: ['user']
  };

I do not know to create a function to receive the value of the checkbox and inserted along with name.




Aucun commentaire:

Enregistrer un commentaire