From the course: Angular Essential Training
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Declaring dependencies using dependency injection - Angular Tutorial
From the course: Angular Essential Training
Declaring dependencies using dependency injection
- [Instructor] Earlier in this course, we looked at how to inject dependencies into your application using Angular's dependency injection. In this video, we'll look at how to declare those dependencies to make them available for use. I opened our project here in a GitHub Codespace. I talked about why we use Codespaces 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 src folder. Open up the app folder, services and click on api.service.ts to open the file. This is the code for our custom API Service. Dependency injection and Angular services are closely linked. You can't use one without the other and most of the time services are all you need but you can inject other things too like strings, booleans, and object literals, as long as you give Angular a provider for that dependency. We'll look at providers in…
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)
-
-
-
-