I am trying to reset user password by sending a mail. On clicking the email the URL is like:
http://localhost:3000/reset/d58d5b16323276a14494fbd6998b0bb9
and it shows the following form
extends ../layout
block content
.col-sm-8.col-sm-offset-2
form(method='POST')
legend Reset Password
input(type='hidden', name='_csrf', value=_csrf)
.form-group
label(for='password') New Password
input.form-control(type='password', name='password', value='', placeholder='New password', autofocus=true)
.form-group
label(for='confirm') Confirm Password
input.form-control(type='password', name='confirm', value='', placeholder='Confirm password')
.form-group
button.btn.btn-primary.btn-reset(type='submit')
i.fa.fa-keyboard-o
| Change Password
On clicking button, the server gets a POST request like /reset/:token
.
This works fine. Now i want to achieve the same functionality in angular js.
I have a controller and the same form. I dont want to do a $http.post()
.
On clicking submit, the server should get a post request at /reset/:token.
Please tell me how to do this in AngularJS without $http.post()
.
AngularJS is used for creating single page applications. Hence the best bet is to use
$http.post
which won't refresh the page and you won't divert form SPA paradigm. However if you don't want to use$http.post
use jQuery/JavaScript to post the form, but that will cause a page refresh.