From the course: Angular Essential Training
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Injecting dependencies using dependency injection - Angular Tutorial
From the course: Angular Essential Training
Injecting dependencies using dependency injection
- [Instructor] Dependency Injection, DI for short, is a software design pattern where classes and functions request dependencies from an external source rather than creating their own instances. It's not specific to the Angular framework, but it's a core concept and every Angular developer should know how it works. You can't use Angular without DI. I opened our project here in a GitHub code space. I talk about why we use code spaces earlier in this course. So for now, just think of them as an easy way to share and write code without installing anything on your local machine. I'll go to the source folder, open the app folder, pages, profile, and click on profile.component.ts to open the file. This is the component controller for our profile page. We looked at components in detail earlier in this course. For now, just know that they're the main building blocks for all Angular applications. To use the dependency, we…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Angular project configuration2m 40s
-
(Locked)
Application environments and build targets3m 52s
-
(Locked)
Injecting dependencies using dependency injection3m 31s
-
(Locked)
Declaring dependencies using dependency injection3m 22s
-
(Locked)
Providing dependencies using dependency injection3m 52s
-
(Locked)
Angular change detection strategies2m 40s
-
(Locked)
Angular component lifecycle hooks2m 52s
-
(Locked)
-
-
-
-