KingKongFrog
KingKongFrog

Reputation: 14429

Animate height of element based on content inside in angularJS

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>

Upvotes: 0

Views: 20

Answers (1)

Venkat smart
Venkat smart

Reputation: 112

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

Upvotes: 0

Related Questions