user3122648
user3122648

Reputation: 917

using angular to modify css class properties

I have a css class 'suggestions-list'in which I have height: initial; in my angularjs code in a condition I want to change height: inherit; how can I modify this css class using angular?

in my CSS file I have :

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

and this is my 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>

Upvotes: 0

Views: 1329

Answers (1)

MeTe-30
MeTe-30

Reputation: 2542

Use ng-style

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

Upvotes: 2

Related Questions