Angular Injection Context Explained

Publicado em: 04 June 2024
no canal de: 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


Nesta página do site você pode assistir ao vídeo on-line Angular Injection Context Explained duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Deborah Kurata 04 June 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 11,783 vezes e gostou 635 espectadores. Boa visualização!