Skip to content
JS

Angular Service Injection with the Dependency Injector (DI)

Course on egghead by Juri Strumpflohner

View on egghead (opens in a new tab)
36 min
LengthVideo runtime
Subscription
Price modelegghead plan
12
Lessons
5.0
Rating out of 51 ratings on egghead
Mar 2018
Published20 Mar 2018

About this course

Description from egghead

Services and registering service providers are an inherent part of an Angular application. It is where you should define your application logic, they keep the state of the application and allow to share that among different components. That said, components can ask for instances of services by specifying them as parameters of their constructor functions which will then provided at runtime by Angular’s dependency injection mechanism. While services themselves are mostly just plain ES2015 classes, there are some interesting things to discover, especially when it comes to dependency injection. We can define services at various levels within our application, which allows us to control the scope and visibility of a given service.

What it covers

12 lessons
  1. 1Introducing Angular Service Injection with the Dependency Injector
  2. 2Define an Angular Service
  3. 3Register a Service to Angular’s Dependency Injection Mechanism
  4. 4Create Multiple Angular Service Instances
  5. 5Define an Aliased Class Provider in Angular
  6. 6Simplify an Angular Service using a JavaScript Object as a Value Provider
  7. 7Instantiate a Service using an Angular Factory Provider
  8. 8Pass Dependencies to a Factory Provider in Angular
  9. 9Overwrite a Service in a Component Subtree in Angular
  10. 10Use an Abstract Class as DI Token for your Services in Angular
  11. 11Control the dependency lookup with @Host, @SkipSelf and @Optional
  12. 12Avoid Multiple Service Instances in Lazy Loaded Modules in Angular

Similar Angular courses

  1. Advanced Angular Component Patterns

    egghead · Isaac Mann · 9 lessons · 4.5 from 24 ratings · Oct 2018

    32 minSubscription
    egghead94.5 (24)Oct 2018
  2. Getting Started with Angular Elements

    egghead · Juri Strumpflohner · 9 lessons · 4.6 from 7 ratings · Feb 2019

    41 minSubscription
    egghead94.6 (7)Feb 2019
  3. Learn HTTP in Angular

    egghead · Juri Strumpflohner · 11 lessons · 5.0 from 4 ratings · Dec 2017

    42 minSubscription
    egghead115.0 (4)Dec 2017
  4. The 80/20 Rule - Build a strong AngularJS Foundation

    Master.dev · Lukas Ruebbelke · 2 lessons · Aug 2014

    17 minFree
    Master.dev2Aug 2014
  5. Server Side integration with AngularJS

    Master.dev · Lukas Ruebbelke · 2 lessons · Aug 2014

    15 minFree
    Master.dev2Aug 2014
  6. AngularJS In Action

    Master.dev · Lukas Ruebbelke · 2 lessons · Aug 2014

    12 minFree
    Master.dev2Aug 2014
  7. Intermediate1 h
    CourseraJul 2024
  8. Angular.js for Beginners: Directives

    Coursera · Shineta Horton, M. Ed · Jun 2023

    Beginner1 h 30 min
    CourseraJun 2023

A hyphen means the provider's catalogue does not state the value.

Same topic, nearest in length, up to three from any one provider.

Data read from the egghead catalogue on 28 Nov 2026. How the data is collected.

    Compare