【发布时间】:2016-02-03 15:00:33
【问题描述】:
带有名称和复选框的表单。
我可以把名字放到 MongoDB 里面,但是如何把复选框的值放到 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>
收藏电影
db.films.insert({aome:" lara croft", gender:['action', 'adventure'] })
函数添加电影
$scope.addManga = function() {
$http.post('/films', $scope.film).success(function(response) {
})};
$scope.roles = [
'adventure',
'action'
];
$scope.user = {
roles: ['user']
};
我不知道创建一个函数来接收复选框的值并与名称一起插入。
【问题讨论】:
-
你的后端代码在哪里?你在用 Node 吗?
标签: javascript jquery angularjs mongodb checkbox