Animate height of element based on content inside in angularJS

23 Views Asked by At

I'm trying to animate the height shrinking and growing based on content inside of the element using ng-if. The issue here is with nganimate I can't get the animation to work at all. It's a simple example.

<div>
     <div ng-if="this">
         Small text
     </div>
     <div ng-if="that">
          <p>Reall long text that can</p>
          <p>be several lines long</p>
     </div>
</div>
1

There are 1 best solutions below

0
Venkat smart On

You can use ng-class to do that

<div>
     <div ng-class="{small: if-Your-condition-True}">
         Small text
     </div>
     <div ng-class="{big: if-Your-condition-True}">
          <p>Reall long text that can</p>
          <p>be several lines long</p>
     </div>
</div>

in this method, you can create an animation