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

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…

Contents