Day 1: Using Dependency Injection
Today we begin learning about AngularJS by looking at dependency injection and services. After discussing those foundations, we’ll jump right into building a sample application. We’ll define resources that talk to the server and even write automated tests that exercise our code. We’ve got a big day ahead of us!
One of the most distinguishing features of AngularJS is its dependency injection container. Without it, direct function calls between components tie them together for life. Instead, you define services and indicate what other services are needed by each service, keeping a clean separation of concerns.
Dependency injection goes a long way in keeping your code modular and testable. Each service is a block ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access