Home > Mobile >  Inline style interpolation not working angular9 [duplicate]
Inline style interpolation not working angular9 [duplicate]

Time:10-06

I would like to pass my component property values to inline css.

<div [ngStyle]="{ 'width': '{{ object.value }}%' }">

The method is not working and getting error:-

 Parser Error: Got interpolation ({{}}) where expression was expected

CodePudding user response:

Your syntax is wrong. Use one of below syntax

[style.width.%]="object.value"

Or

[ngStyle]="{ 'width.%': object.value }"
  • Related