Using @HostBinding with Signals
Вставка
- Опубліковано 26 лип 2024
- If you’re building apps with Angular, you’re probably using signals more and more every day. This can definitely be a challenge at times because it’s such a different way of working. And, there are things that just don’t quite work with signals yet, like @HostBinding for example. Well in this video, I’m going to demonstrate how we can actually use the @HostBinding decorator with signals, pretty easily right now even though the decorator was not originally built to support them directly. Alright, let’s get to it.
------------------------------------------------------------------------------
💖 Help Support the Channel:
If you found this helpful and want to show some love, you can always buy me a coffee (buymeacoffee.com/briantreese)!
------------------------------------------------------------------------------
🔗 Demo Links:
- Before (stackblitz.com/edit/stackblit...)
- After (stackblitz.com/edit/stackblit...)
------------------------------------------------------------------------------
📖 Chapters:
0:00 - Introduction
0:41 - The Demo Application
1:25 - Using @Hostbinding with a Signal Input
2:58 - Converting Decorator Inputs to Signal Inputs
3:53 - Using an effect to Update the @HostBinding when the Signal Changes
5:43 - Conclusion
------------------------------------------------------------------------------
#angular #angular_developer #angulartraining #javascript #typescript #frontend #angularcourse #signals #signal #signal_input #angular_components #angular_directives - Наука та технологія
Thank you for this video.
It is also possible to use @Component({host: {'[class.complete]': 'isComplete()'}})