angular 2 ngIf and CSS transition/animation

前端 未结 7 1773
予麋鹿
予麋鹿 2020-11-29 16:23

I want a div to slide in from the right in angular 2 using css.

  

7条回答
  •  情书的邮戳
    2020-11-29 16:50

    Am using angular 5 and for an ngif to work for me that is in a ngfor, I had to use animateChild and in the user-detail component I used the *ngIf="user.expanded" to show hide user and it worked for entering a leaving

     
    //the animation file export const FLIP_TRANSITION = [ trigger('flyInParent', [ transition(':enter, :leave', [ query('@*', animateChild()) ]) ]), trigger('flyIn', [ state('void', style({width: '100%', height: '100%'})), state('*', style({width: '100%', height: '100%'})), transition(':enter', [ style({ transform: 'translateY(100%)', position: 'fixed' }), animate('0.5s cubic-bezier(0.35, 0, 0.25, 1)', style({transform: 'translateY(0%)'})) ]), transition(':leave', [ style({ transform: 'translateY(0%)', position: 'fixed' }), animate('0.5s cubic-bezier(0.35, 0, 0.25, 1)', style({transform: 'translateY(100%)'})) ]) ]) ];

提交回复
热议问题