It is basically used to set the style in HTML elements.
Syntax:
<tagname [style.characteristic]="varname">
|
color
background-color
Some styles like font-size have a unit extension. To set the font-size in pixels, use below syntax
<button style='color:red' [style.font-size.px]="FontSize">Click Me
</button>
Example:
I am going to use the previous example only.
https://dotnetbyudayrajakonda.blogspot.com/2023/10/property-binding-in-angular.html
.html changes
<button style='color:red' [style.font-weight]="IsBold ? 'bold' : 'normal'">Click Me</button>Outputuse NgStyle directive
Make below changes to the .ts file
No comments:
Post a Comment
Thank you for visiting my blog