Angular Injection Context Explained

Published: 04 June 2024
on channel: Deborah Kurata
11,783
635

Ever wonder what an Angular injection context is? Angular's dependency injection system relies on a runtime context called the injection context. We can only use dependency injection in code that runs in that injection context.

In this video, we explain what an injection context is, examine where the injection context is available, and walk through what happens when you inject a dependency outside of the injection context. We use both constructor-based dependency injection, and the inject function introduced in Angular v16.

Links
Code: https://stackblitz.com/~/edit/injecti...

Documentation: https://angular.dev/guide/di/dependen...

Content
00:00 What is the injection context?
00:09 Dependency injection
00:35 inject() function
01:43 Injection context
02:45 Where the injection context is not available
05:11 inject() in an exported function
06:33 Wrap up

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I'm a software developer and YouTube content creator. I speak at conferences such as VSLive and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 7,000+) for over 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).

View my YouTube content:    / @deborah_kurata  
Contact me on Twitter:   / deborahkurata  
Find my Pluralsight courses: https://www.pluralsight.com/profile/a...
Access my freeCodeCamp articles: https://www.freecodecamp.org/news/aut...

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#angular
#dependencyinjection
#injectfunction
#angulardependencyinjection
#angulardependencyinjectiontutorial
#angulardependencyinjectionexplained
#dependencyinjectioninangular
#angulardependencyinjectionindepth
#angulartutorial
#injectioncontext
#angularinjection
#dependencyinjectionexplained
#angulardependencyinjectionexample
#dependencyinjectionangular
#angular16dependencyinjection


On this page of the site you can watch the video online Angular Injection Context Explained with a duration of hours minute second in good quality, which was uploaded by the user Deborah Kurata 04 June 2024, share the link with friends and acquaintances, this video has already been watched 11,783 times on youtube and it was liked by 635 viewers. Enjoy your viewing!