I have defined two variables for ngstyle
ngStyleSmall = {
width: '150px !important',
'max-width': '150px',
};
ngStylemedium = {
width: '250px !important',
'max-width': '400px',
};
ls_style:string
ls_style="ngStyleSmall" // will be fetched from database
<mat-form-field [ngStyle]="ls_style">
<input [(ngModel)]="code" name="code" matInput placeholder="Co.">
</mat-form-field>
In the html ng model, I need to assign a variable dynamically. How can this be achieved?