Search code examples
htmlcssangularcomponents

How to use "repeat()" css function combined with Angular ngStyle directive?


Let's assume that you have div in some component's html template:

<div [ngStyle]="{'grid-template-columns': repeat(5, 20%)}"></div>

How to make repeat() css function work in that scenario?


Solution

  • You just need to put the right side in quotations:

    <div [ngStyle]="{'grid-template-columns': 'repeat(5, 20%)'}"></div>