I am trying to create a link in an AngularJS application view to send a DELETE data method.
My route:
app.delete('/logout', function(req, res) { req.session = null res.status(200) res.redirect('/') })
My PugJS template:
a(ng-href='/logout', data-method='delete', data-confirm='Are you sure?', rel='nofollow') span(translate) Logout
Generated 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>
But when I follow the link, I get the following message:
Cannot GET /logout
It seems to me that the data method is not working. Does anyone know what is going on?
Thanks, bye.
source share