这是我的猫鼬模式
var VoSchema =new Schema({
name:{type: String,
required: true},
price:{type: String},
feeds : [Schema.Types.Mixed]
}, {strict: false});
动态输入字段
<div ng-repeat="item in inputs">
<div>
<input ng-model="item.description">
</div>
<div>
<input ng-model="item.qty">
</div>
<div>
<input ng-model="item.cost"/>
</div>
<div >
{{item.cost * item.qty}}
</div>
</div>
<a class="btn btn-primary" href ng-click="addfield()" >[+]</a>
</div>
angularjs的控制器
$scope.submitx = function(inv){
$scope.inv.feeds = $scope.inputs.item
console.log(inv);
PostBlog.createInvoice(inv).then(function(data){
console.log(data);
});
$scope.inv= {};
}
$scope.inputs = [];
$scope.addfield=function(){
$scope.inputs.push({ qty:0, cost:0, description:"" })
}
我想将数组中的数据推送到mongodb,我该如何实现? 请详细解释一下?如何在平均堆栈中使用动态表单。