我有两个名为bloodbankchapters
和users
的集合,这是结构:
bloodbankchapters users
chapter_name: String name:String
chapter_id:String branch_id:String
chapter_name:String
然后我有一个选择框,用于输出我的血统章的chapter_name,然后将其注册到user.chapter_name
<select class="form-control dropdown-toggle" ng-model="register.regData.branch" >
<option ng-repeat="chapter in register.bloodbankchapters" >{{chapter.chapter_name}}</option>x`
</select>
<button ng-disabled="register.disabled" class="btn btn-primary" type="submit">Submit</button>
我的问题是,当我在选择框中选择名称时,如何也将bloodbankchapter.chapter_id注册到user.branch_id?
这是我注册用户的控制器:
.controller('regCtrl', function(User, Bloodbankchapter) {
Bloodbankchapter.getBloodbankchapters().then(function(data) {
app.bloodbankchapters = data.data.bloodbankchapters;
});
var app = this;
this.regUser = function(regData) {
User.create(app.regData).then(function(data) {
});
};
})