Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript variable to style Angular 2

Tags:

html

css

angular

I would like to pass typescript variable to style, I dont know if it's possible, there is code:

<tr *ngFor="let app of data">
    <div class="progress_bar" style="width: {{app.applicationProgress}}%;"></div>
</tr>

My app.applicationProgress is set(checked)

like image 817
Jędrek Markowski Avatar asked Dec 11 '25 07:12

Jędrek Markowski


1 Answers

Use the ngStyle directive. Documentation

Updated code:

<div class="progress_bar" [ngStyle]="{'width': app.applicationProgress + '%'}"></div>
like image 101
JSON Derulo Avatar answered Dec 14 '25 02:12

JSON Derulo