Answer the question
In order to leave comments, you need to log in
How to subscribe Angular.js to sockets?
Hey!
When running the script, I need to subscribe the user to notifications, but I need to do this once. The problem is that if processed in the controller, then when you go to another page, the service tries to sign for notifications again, you can screw it up and check it every time, but I don’t think that this makes sense.
Tell me how to execute the code I need once only when Angular is initialized?
I will add, subscription to notifications through the service: Notification.init ()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question