I have created a collection in mondoDB called Mangas , where it has " name, author, gender and info
Gender is array.
I have a form that will receive the values name, author and info, Checkbox needs to be filled as Array with values to be inserted with the forumulario
Question. How to make a Checkbox that has 2 options Adventure and Action and insert in mongoDB as an array?
Same as the collection below.
MongoDB Sleeves
db.mangas.insert({
nome:'Toriko',
autor:'não sei',
genero:['aventura','ação'],
info:'...'
})
Index.html
<tr>
<td><input class="form-control" ng-model="manga.nome"></td>
<td><input class="form-control" ng-model="manga.autor"></td>
<!-- aqui precisa ser a CHECKBOX que irá ter os valores do array e inseridos no GENERO -->
<td><input class="form-control" ng-model="manga.info"></td>
<td><button class="btn btn-primary" ng-click="addManga()">Add manga</button></td>
</tr>
<tr ng-repeat="manga in mangas">
<td>{{manga.nome}}</td>
<td>{{manga.autor}}</td>
<td><!-- aqui vai listar o valor recebido do checkbox --></td>
<td>{{manga.info}}</td>
</tr>
Function addManga
$scope.addManga = function() {
console.log($scope.manga);
$http.post('/mangas', $scope.manga).success(function(response) {
console.log(response);
refresh();
})};