-1

In VS Code angular project I have this warning !

"Expected a number type" Angular

When I use data binding html attribute in template:

[style.font-size]="16+i+'px'"
0

1 Answer 1

0

The good way is:

[style.font-size.px]="16+i"
Sign up to request clarification or add additional context in comments.

5 Comments

use literal template like ${ 16 + i }px
It doesn't work because I use data binding html attribute [style.font-size]="..."
you can use [style.font-size.px]="16+i" instead of [style.font-size]="(16+i).toString()+'px'"
@a-morel , this is a working demo , you can check it stackblitz.com/edit/angular-z3map8
@Ghoul Ahmed Indeed it's much better! Thank you

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.