TutorialLesson 11Free preview
AngularJS Services
This lesson is part of AngularJS · All levels
Summary
Services in AngularJS are a single-body object that provides logic or data that can be used anywhere, such as $http, $location, and $timeout. You can create your own service with a factory, service, or provider. This pattern keeps logic separate from the controller and easy to test.
Key points
- AngularJS is a singleton service distributed to all consumers
- How to make: module.factory, module.service, and module.provider
- Inbuilt service: $http, $location, $timeout, $filter
- Putting logic in service keeps the controller thin
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.