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 ...
Get Seven Web Frameworks in Seven Weeks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.