我一直关注此处的幻灯片指南:http://ng.malsup.com/#!/css-animations-for-ng-hide_ng-show
除了我想要相反的效果。我希望内容在点击时向下滑动/显示,而不是在点击时向上滑动/隐藏。因此,内容在加载时隐藏。我在这里创建了一个plunker,但似乎不起作用: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;
}
不觉得ng-animate是作为依赖项成功添加的。
更新:
更新了plunker:http://plnkr.co/edit/Vwuin1KLrNUDSkfv7cBy?p=preview
答案 0 :(得分:2)
请参阅演示:http://plnkr.co/edit/N6fPYgipvML2rzmEt4So?p=preview
看起来您需要更改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>