0

i need to change height of the parent element when ng-If is true and it display a rectangle, but have no idea how.

My structure looks like:

<div class="parent">
    <form> 
        <div ng-if="sth" class="child"> 
        </div>
    </form>
</div>

when the if statement is true, then parent height has to change.

R. Richards
  • 24,603
  • 10
  • 64
  • 64
ngCode
  • 1
  • You may find the answer to this similar question helpful: https://stackoverflow.com/questions/35269179/angular-conditional-class-with-ngclass – DrogoNevets Dec 23 '21 at 08:22

1 Answers1

0

Your question is a little vague... not sure what height you want to set etc... but here's an example:

<div class="parent" ng-style="{ height: sth ? '400px' : 'auto' }">
    <form> 
        <div ng-if="sth" class="child"> 
        </div>
    </form>
</div>
Mathew Berg
  • 28,625
  • 11
  • 69
  • 90