In this video, learn how to use the @Injectable decorator on a service class to configure it to automatically be provided in the root NgModule of the application.
was like registering it in the root injector. … Angular has another way to wire up injectables … to the root provider, … that could be used to tell Angular … In the media-item.service.ts file, … and pass it in an object literal … with a property named "providedin" … With this set, … this is the preferred approach to registering it, … not only because it keeps the registration logic … this can come into play in cases where we have a service … something we will cover when we go over routing in Angular. … to register this media item service class at the root level … in the providers array in the NgModule. … and we can remove the import statement, … and then we can remove the providers array … with the media item service. … …
- What is Angular?
- Working with components
- Binding events and properties
- Getting data to components
- Using directives and pipes
- Creating Angular forms
- Validating form data
- How Angular does dependency injection
- Making HTTP calls
- Styling components
Skill Level Intermediate
Angular: Building an Interfacewith Ray Villalobos2h 20m Intermediate
1. Architecture Overview
3. Directives and Pipes
5. Dependency Injection and Services
8. Styling Components
Next steps1m 20s
- 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.