我无法使用Angular 4打字稿动态设置Div元素的高度。
预先感谢
答案 0 :(得分:1)
使用具有您要输入的高度的变量...,然后使用[ngStyle] =“ {'height':[yourVariableName]}”
答案 1 :(得分:0)
对于div,添加[class] =“ ifSomething?'class1':'class2'”
答案 2 :(得分:0)
可以通过以下方式使用 [style.height] :
//shouldExpand is a condition, you can replace it with your condition
<div class="yourClass"
[style.height]="shouldExpand === true ? '100px' : '70px'">