As a rule of thumb, if you want to re-use your  functionality in different 
controllers then you should create it as a service instead of hard coding 
in one controller.

This would minimize code redundancy and make your app more modular.


On Tuesday, April 29, 2014 8:59:04 AM UTC+5:30, 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.

Reply via email to