Avi, yes, it can be good to keep services stateless. In the case of interoperating controllers however, this is not a useful reality. In our example, we have a conversation view with an options panel on the right, and a navigation on the left. If you select a conversation on the left then you need to load it, and store model information. the 'selected conversation' needs to be stored somewhere, as does all of the loaded conversation models. These are stored in a 'rooms' manager service. You are right that the state of this rooms manager could be linked to the url (if we wanted its state to persist between page refreshes), but that isnt required for us. So, the rooms manager stores the conversation state which is referenced by 3 controllers. In this way they can share state.
On 18 November 2014 10:42, Hasan Ali <[email protected]> wrote: > Thanks Tony and Vivek for your suggestions. > On Nov 18, 2014 1:33 PM, "Vivek Anand" <[email protected]> wrote: > >> Tony, I would not recommend any service to store any data. Usually, >> service classes must be stateless. Please share, if you have any views. >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "AngularJS" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/angular/ygBUnIi30nc/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- Tony Polinelli -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
