Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular ng-show / hide animations

I have been following the slideUp guide here: http://ng.malsup.com/#!/css-animations-for-ng-hide_ng-show

Apart from i want the opposite effect. Instead of sliding up/hiding on click, i want the content to slide down/appear on click. So, the content is hidden on load. I have created a plunker here, but doesnt seem to work: http://plnkr.co/edit/12wPKGqn4g3Fctm7NKnA

HTML:

<ul>
      <li ng-repeat-start="item in data">
        <p>Name: {{item.name}} <span ng-click="example1=!example1">+</span></p>
      </li>
      <li ng-repeat-end class="cssSlideUp"  ng-hide="example1">
        DOB: {{item.dob}}
        Gender: {{item.gender}}
      </li>
    </ul>

CSS:

.ng-hide-add, .ng-hide-remove {
    /* ensure visibility during the transition */
    display: block !important; /* yes, important */
}

.cssSlideUp {
    transition: .3s linear all;
    height: 100px;
    overflow: hidden;
}
.cssSlideUp.ng-hide {
    height:0;
}

It doesnt feel like ng-animate is being successfully added as a dependency.



UPDATE:

Updated plunker: http://plnkr.co/edit/Vwuin1KLrNUDSkfv7cBy?p=preview

like image 737
Oam Psy Avatar asked Dec 21 '25 21:12

Oam Psy


1 Answers

Please see that demo : http://plnkr.co/edit/N6fPYgipvML2rzmEt4So?p=preview

it looks like you need to change a bit structure of your DOM

<ul>
  <li ng-repeat="item in data">
    <p>Name: {{item.name}} <span ng-click="example1=!example1">+</span></p>

  <p  class="cssSlideUp"  ng-hide="example1">
    DOB: {{item.dob}}
    Gender: {{item.gender}}
    </p>
  </li>
</ul>
like image 156
sylwester Avatar answered Dec 23 '25 12:12

sylwester