我试图在 AngularJS 应用程序的视图中创建一个链接,只是为了发送一个数据方法 DELETE。
我的路线:
app.delete('/logout', function(req, res) {
req.session = null
res.status(200)
res.redirect('/')
})
我的 PugJS 模板:
a(ng-href='/logout', data-method='delete', data-confirm='Are you sure?', rel='nofollow')
span(translate) Logout
生成的 HTML:
<a ng-href="/logout" data-method="delete" data-confirm="Are you sure?" rel="nofollow" class="" href="/logout">
<span translate="translate" class="ng-scope">
<span class="ng-scope">Logout</span>
</span>
</a>
但是当我点击链接时,我收到以下消息:
Cannot GET /logout
在我看来,数据方法不起作用。有人知道发生了什么吗?
谢谢一会儿。