Ganaraj,

Sounds like a fun problem, to me... but then, I just learned about it this 
morning.  :-)

How about this approach:

   1. Define a type within your (singleton) service; you will use this for 
   your "non-singleton service instances."
   2. Give your service a factory method which accepts context as an 
   argument, and returns an instance of the type defined in (1).
      1. If you need access to other objects created by this factory, 
      maintain a hash of them within your service, and then give the service 
some 
      retrieval methods.
         1. You could even make this structure hierarchical, if you wanted 
         to.
      3. Continue to inject the service as you are doing, relying primarily 
   on its factory method; consume instances with your controller/directive.

What do you think?


On Thursday, September 4, 2014 7:15:20 AM UTC-4, ganaraj P R wrote:
>
> Hi,
>
> We are facing an issue where we need to be sharing non singleton states 
> between controllers. I have explained it in more detail in here
>
>
> http://stackoverflow.com/questions/25663978/sharing-non-singleton-state-between-controllers-angular-architecture
>
> I would welcome any discussion regarding this. As more and more apps get 
> built with Angular and the more larger apps that get built with it - Things 
> start getting larger and complicated - A community driven way of figuring 
> out common architectural patterns and anti-patterns would be amazing. 
>
>
>
> -- 
> Regards,
> Ganaraj P R 
>

-- 
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.

Reply via email to