嘿,我不知道怎么去纳克标签输入名称,然后从服务器赶上它request.body它只是不是有NG标签输入获得的名称,并从服务器req.body
抓住它模板HTML(有更多的标签,但其他人正常工作有投入和textarea的我只放一个工程和标签输入是不工作)
<form action="/projects" method='POST'>
<label>Title</label>
<input type="text" name="title" ng-model="title" placeholder="Your title">
<tags-input use-strings="true" ng-model="tags" display-property="tags" placeholder="Add a Tag"></tags-input>
<input class="btn btn-primary" type="submit" value="Start new project">
</form>
服务器
const Project = require('../../../models/project')
function addProject (req, res) {
const { title } = req.body
console.log(req.body)
const project = new Project({ title })
project.save()
.then(() => res.redirect('/app/#!/start-project'))
}
module.exports = addProject
这就是console.log请求身体:image log
如果需要别的东西说我这是我的第一篇文章,我只是在学习谢谢!
我试图映射的对象,但它返回里面 数组中的其他对象PD:我忘了把输入提交的例子 –
@Marcvergara让我知道它是否有帮助 –
还没有,但谢谢 –