The thing that you will run into is if you make http calls from your controller then it is more painful to write unit tests. If you use a service there is a lot less overhead in mocking that service response then in spying on $http.
On Monday, April 28, 2014 10:29:04 PM UTC-5, Rajesh wrote: > > Can I call a REST api using $http directly in my controller? When would I > need to create my own service vs using $http service from controller? Most > of the examples on the web just call $http in a custom service. > -- 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.
