Hi Sander Elias, Thank you for providing your valuable suggestions, the controller as api really is an awesome concept I did learned a lot researching on it.
I have created a small code snippet on plunker <http://plnkr.co/edit/O0iuyEXbzHjzwWRjJmqU?p=preview>, referring back to my question I was able to communicate between directives using controllers and a service injected between them. But it seems like $watch discards the event on the default value of service variable. It would be of great help if you can take look on this code snippet. I have tried to keep it as simple as possible. Also, can this implementation be scalable, for e.g using these two directives at multiple places within the same HTML page. Please do let me know for if I can modify something to make it much more effective. Thank you again, Anurag. On Thursday, March 12, 2015 at 4:29:01 PM UTC+5:30, Sander Elias wrote: > > Hi Anurag, > > Don't use scope at all, use the directive controllers to communicate to > each other. Events are not the right solution in this case, and those > 'travel' the entire application for no good reason. > I made quite a few examples of this, search this group for something like > controller as API. > When you want a tailor made sample that fits your needs, post a plunker > <http://plnkr.co/edit/tpl:QzPKsT47fvBoPABDSCr4?p=catalogue>with what it > is you want to do. Make it as small as possible. > > Regards > Sander > -- 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.
