TheRusskiy / ng-slide-down

AngularJS directive for slide-down animation
41 stars 16 forks source link

ng-slide-down variable gets updated outside the digest cycle #12

Open ghost opened 9 years ago

ghost commented 9 years ago

I'm using angular-material.

<md-card>
card header here
 <md-card-content ng-class="vm.edit ? '' : 'hide-char-counter'; vm.collapse ? 'no-padding': ''" ng-slide-down="!vm.collapse" lazy-render>Mycontent</md-card-content>
</md-card>

md-card-content, sets a padding of 16px. When my card is collpased, I have an undesired result because md-card-content's padding is visible even though it's collpased.

My solution was to set padding:0 if it's collpased. But the class is never added with ng-class and it's because of how you change the collapsed variable.

Maybe the simple solution is to wrap it in a timeout.

Also if ng-slide-down is true on dom load, I would like it if it didn't do the slide down animation. It happens fast, but it still happens and looks sloppy on page load, with or without lazy-render.