filmov
tv
3 ways to add dynamic CSS custom properties in Angular components

Показать описание
Sometimes you may need to programmatically set the value for a CSS custom property while building components in Angular. I personally run into situations occasionally where I need to use a custom property that needs to be set with a dynamic value. Like a bar chart for example, where the items in the chart are based off of dynamic data.
Well in this video, we’re going to look at three different ways to set custom properties programmatically. We’ll use basic style binding, then we’ll use the Renederer2 setStyle() method, and after that, we’ll use host element binding.
------------------------------------------------------------------------------
🔗 Demo Links:
------------------------------------------------------------------------------
📚 Additional Resources:
------------------------------------------------------------------------------
📖 Chapters:
0:00 – Introduction
0:40 – Using Style Binding in the Component Template
2:49 – Using the Renderer2 setStyle() Method with RendererStyleFlags.DashCase
7:26 – Using Style Binding on the Component Host with Host Element Binding
8:40 – Conclusion
------------------------------------------------------------------------------
#angular #angulartutorial #css
Well in this video, we’re going to look at three different ways to set custom properties programmatically. We’ll use basic style binding, then we’ll use the Renederer2 setStyle() method, and after that, we’ll use host element binding.
------------------------------------------------------------------------------
🔗 Demo Links:
------------------------------------------------------------------------------
📚 Additional Resources:
------------------------------------------------------------------------------
📖 Chapters:
0:00 – Introduction
0:40 – Using Style Binding in the Component Template
2:49 – Using the Renderer2 setStyle() Method with RendererStyleFlags.DashCase
7:26 – Using Style Binding on the Component Host with Host Element Binding
8:40 – Conclusion
------------------------------------------------------------------------------
#angular #angulartutorial #css
Комментарии