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:
- Medium: https://medium.com/@nhannguyendevjs/
- Dev: https://dev.to/nhannguyendevjs/
- Hashnode: https://nhannguyen.hashnode.dev/
- Linkedin: https://www.linkedin.com/in/nhannguyendevjs/
- X (formerly Twitter): https://twitter.com/nhannguyendevjs/
Top comments (0)