I have converted one of my modals to angular. Earlier I was submitting modal using:
<form role="form" action="/home" method="post">
and on controller side(ExpreessJS) I used following two lines to 1) show a success flash 2) reload the current page after various DB transactions have happened successfully so that current page reloads and appropriate success flash is poped up.
Route looks like this:
app.post('/home',someController.someMethod);
req.flash('success', 'Successful');
res.redirect(req.headers.referer);
Now, with angular I have to do something like this on the same controller, where data
is the JSON
containing form
variables:
$http.post('/home',data);
In my first method(without Angular), the flash is shown and page reloads.But with angular neither of event happens.
How to achieve the same functionality or behavior when POSTing using angular?