-1
我想更新我的mongodb我知道在服务器端写什么,但我不知道如何在角度上在客户端使用它。你能帮我吗 ? 这里是我的服务器端代码更新mongodb在平均堆栈
module.exports.updateUser = function (req, res) {
// get a user with ID of 1
User.findById(1, function(err, user) {
if (err) throw err;
// change the users location
user.location = 'uk';
// save the user
user.save(function(err) {
if (err) throw err;
console.log('User successfully updated!');
});
});
}
10q为你的回应。你能解释一下脚本是什么吗? –
在脚本标记我创建了一个角度的应用程序模块,我打电话给一个http休息api调用(/用户/保存) –
什么是$ scope.SendData的使用和我如何传递参数,如ID –