Skip to main content

Command Palette

Search for a command to run...

⭐ Angular - DI with inject function⭐

Updated
1 min read
⭐ Angular - DI with inject function⭐
N

I'm Nhan. I'm a web developer from Vietnam. I have over 5 years of experience in the Angular framework.

Example of Token Helper

👉 token.ts
➖ Create an InjectionToken with an initial value
➖ Create a Provider function

👉 Usage:
➖ Provide TOKEN in the component.
➖ Inject TOKEN into the component.

You can run it on Stackblitz and fork the project to debug.


I hope you found it useful. Thanks for reading. 🙏

Let's get connected! You can find me on:

More from this blog

Nhan Nguyen's blog

88 posts

I’m a web developer, and I am really passionate about learning web development.