0

I have an angularjs module deployed on a nodejs server. The nodejs also has an REST end point.

Whenever I get a hit in the nodejs REST end point, I want to update a scope variable in angularjs script and then I have to redirect the user to a page after that.

I thought of using event emitter, but i couldn't do that since the event emitter require response.write, and I couldn't redirect to the page after this.

Is there any way I can do achieve this ?

Albie Morken
  • 215
  • 1
  • 4
  • 14

1 Answers1

1

You should use EventSource to send notifications to client. It's built for that purpose. You can use EventSource package for that purpose in Node.js.

You shouldn't redirect the client from the server, if you're using Angular's routing. Instead let the Angular Router redirect after it receives the push notification.

tbking
  • 8,796
  • 2
  • 20
  • 33