在表格中显示来自猫鼬的数据。如何使删除按钮才能正常工作,从表中删除所选元素猫鼬 - 删除选定元素
的index.html
<div class="col-md-12 column list-group">
{% for note in notes %}
<div class="list-group-item">
<div>Note from <em><strong>{{ note.memberName }}</strong></em> on: {{ note.createdOn.toDateString() }}``
- for project: <strong>{{ note.project }}</strong></div>
<div><strong>Work yesterday:</strong> {{ note.workYesterday }}</div>
<div><strong>Work today:</strong> {{ note.workToday }}</div>
<div><strong>Impediment:</strong> {{ note.impediment }}</div>
<form action="/delete" method="post">
<button class="btn btn-danger" type="submit">DELETE</button>
</form>
</div>
{% endfor %}
index.js
router.post('/delete', function(req, res, next) {
var id = req.body.id;
Standup.findByIdAndRemove(id).exec();
res.redirect('/');
});
你会得到任何错误吗? – Karim
你的问题是什么? –