我已經在控制器中創建陣列和用於angularjs視圖在下拉該值如何以保存選擇的下拉值MongoDB中
控制器:
$scope.menus = ['Home','WorkFlow','Statistics','Users','Projects','Setting'];
視圖:
<select name="selectedRole" ng-model="selectedRole" ng-options ="x.role for x in roles">
<option value="">Role</option>
</select>
在服務器.js我寫了保存功能
app.post('/addUser', function(req, res) {
userCollection.save(req.body, (err, result) => {
if (err) return console.log(err)
console.log('Roles Added');
res.redirect('/users')
console.log('result')
})
})
但我不知道如何將選定的Dropdown值保存在我的mongodb中。我正在使用mongoclient
請問任何人都可以幫我解決這個問題。
然後,當您提出問題時,您應該稍微清楚一點。 – t1gor
當然,謝謝..其實我是編碼新手。我會提高自己提出問題。 – Vishnu