Ben, just to add to your point, a controller is BIND to a view/ HTML/ JSP/ Directive and might not be a good candidate for reusuablity in the application and are good to write complex logic specific to the view they are bind/ wire to via scope. Whereas, services are singletons and are good candidates to write complex logic for HTTP call, Rest Services handling, promises, sharing common code b/w different controllers/ views, utilities and more.
Regards Rishi Tandon On Mon, Sep 15, 2014 at 10:32 AM, Ben Rethmeier <[email protected]> wrote: > I'm getting started with Angular coming from an MVVM (XAML) > world\perspective. I started by seeing my controller as my ViewModel and I > just put everything on its scope and had thought that services were > primarily for like server call services (ajax call to get some data or > something). Now I'm starting to feel like I should make all code into a > service and just glue them together in a controller and have the > controller have really no code, just pulling things from services onto the > scope. Does that sound reasonable? I know you can use the tool anyway you > like, so I guess I'm asking what do people usually put in their controllers > and is there good reason not to put it in a service other than preference > or ease? > > Any thoughts, opinions, or feedback is appreciated. > > -- > 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. > -- *Rishi Tandon* Pearson Learning Technology Group Mobile: (310) 926-9032 Pearson Always Learning Learn more at www.pearson.com -- 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.
