javascript - Angularjs, How make checkbox array to insert in mongoDB -
i created collection in mongodb call mangas, has " name, autor, genre , info "
gender array.
i have form receive name values, , autor info, checkbox come array filled values entered in form
question.
how make checkbox has 2 options ** "adventure ** , ** action" ** , enter mongodb array?
same collection below.
mongodb mangas
db.mangas.insert({ nome:'toriko', autor:'não sei', gender:['adventure','action'], 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 checkbox que irá ter os valores array e inseridos no gender --> <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 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(); })};
Comments
Post a Comment