以下代码适用于按钮,不使用ngstyle。
<input type="{{y.cellNumber}}" src="{{y.src}}" value="{{y.name}}" style="height:20px;width:50px">
&#13;
但如果我使用ngstyle无法显示按钮,那么如何使用ngstyle进行操作
<input type="{{y.cellNumber}}"
src="{{y.src}}" value="{{y.name}}"
[style.height.px]="y.height*2"
[style.width.px]="y.width/2"
[style.background]="y.background"
[style.color]="y.color" >
&#13;
答案 0 :(得分:0)
在此示例中使用NgStyle:
<input
[ngStyle]="{ 'background': y.background, 'color': y.color, 'height.px': y.height*2 , 'width.px': y.width/2 }">