0

We are following this pattern in which every function requesting to server is written in a service in angular application.

Then in controller we call that function like this - suppose- service name is - homeService

then we use it like this -

homeService
.getUserName()
.then(getUserNameSuccessCallback, getUserNameErrorCallback);

I wanted to know if the server request is taking long and the user goes to other state, like home to profile so home controller would be destroyed and profile controller would be initialised,would the callback be still fired if the request to server is returned.

Piyush dhore
  • 641
  • 1
  • 9
  • 16
  • This might just be what you are looking for... [do-never-resolved-promises-cause-memory-leak](http://stackoverflow.com/questions/20068467/do-never-resolved-promises-cause-memory-leak) – Marnix Harderwijk Oct 22 '16 at 08:56
  • I wanted to know if the callback will still be called, because while uploading an image the server can take a lot of time and user can go to another module, destroying the current controller, in such a case when the image gets uploaded will the callback be called or not. – Piyush dhore Oct 22 '16 at 11:07
  • I guess that it would be faster to check this rather to ask a question. Yes, it will. There's nothing specific to scope in the code above. – Estus Flask Oct 22 '16 at 12:45

0 Answers0