Angular - Directives
Why is it recommended to use an object for
ngStyle instead of a string of CSS styles?ngStyle instead of a string of CSS styles?Angular uses object references to detect changes and update styles efficiently.
Objects allow Angular to know exactly which styles changed, improving performance. Strings do not provide this granularity.
15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions