Here we demo how to register the service just created by importing the service and adding provider references. Once this is completed, an instance of the movie service is now available for injection in the app components or any of its children. It is at this point we can specify where it needs to be injected.
- [Instructor] So, we just created our MovieService.…Now it's time to register it.…So, to do that, let's go to our app.component.ts file.…And registering the service is fairly straightforward.…All we need to do is add the property for providers…into our component and specify our MovieService.…Now the compiler will complain,…and that's simply because we need to import the service,…so let's go ahead and do that.…
We added our import statement for MovieService,…and now the compilation error goes away.…So, an instance of this MovieService is now available…for injection in the app components…or any of its children.…Now we need to specify where it needs to be injected.…That's up next.…
- Creating components
- Bootstrapping components
- Working with templates
- Using directives and interpolation
- Binding and transforming data
- Creating advanced and nested components
- Creating services
- Obtaining data with HTTP calls
- Configuring routes
Skill Level Intermediate
1. Course Overview
3. Directives, Interpolation, and Templates
5. Advanced Components
7. Obtaining Data with HTTP
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.