![](/img/trans.png)
[英]NgStyle returns: ERROR Error: Cannot find a differ supporting object '{“background-color”:“blue”}'
[英]ngStyle dynamic variable error ERROR Error: Cannot find a differ supporting object 'ngStyleSmall'
我有2個ngstyle
變量
ngStyleSmall = {
width: '150px !important',
'max-width': '150px',
};
ngStylemedium = {
width: '250px !important',
'max-width': '400px',
};
ls_style:string
ls_style="ngStyleSmall" // will be bringing from database
<mat-form-field [ngStyle]="ls_style">
<input [(ngModel)]="code" name="code" matInput placeholder="Co.">
</mat-form-field>
在html ng模型中,我想動態分配變量,怎么可能?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.