1

I have created a new REST call, which accepts the username and password and does verify the username and password.

On top of this REST call, I'm building the UI with angular js. REST call will send JSON as when its success:

{ success : { username : 'batman' } }

Now I want angular js to redirect to the home page. How should I do that?

Is REST calls for login is a good design choice?

Thanks in advance.

batman
  • 3,565
  • 5
  • 20
  • 41

2 Answers2

1

If you're making a request through ajax to login, I believe your api might need to return a reponse that lets your front end app know to redirect, and then redirect in javascript.

Using angular on success you should be able to change location using $location

dm03514
  • 54,664
  • 18
  • 108
  • 145
-1

you have to send the redirect from the Server.... If you are using NODEjs and passport then theres a built in redirect function :)

Max Bumaye
  • 1,017
  • 10
  • 17