使用angular来修改css类属性

时间:2016-07-04 12:04:25

标签: html css angularjs angularjs-scope

我有一个css课程' advice-list'其中我在我的angularjs代码中有height: initial;我希望更改height: inherit;如何修改此css类使用角度?

在我的CSS文件中我有:

.suggestions-list {
    position: absolute;
    list-style-type: none;
    margin: 0 0 0 35px;
    padding: 0;
    overflow: scroll;
    height: initial;
    width: 250px;
    border-bottom: 50px;
}

这是我的HTML:

<ul class="suggestions-list" ng-show="myVar">
     <li ng-repeat="suggestion in suggestions track by $index" ng-class="{active : selectedIndex === $index}" ng-click="AssignValueAndHide($index)">{{suggestion}}</li>
</ul>

1 个答案:

答案 0 :(得分:2)

使用ng-style

<div ng-style="{height: (condition?'initial':'inherit')}"></div>