angular-animations

angular 2 ngIf and CSS transition/animation

淺唱寂寞╮ 提交于 2019-11-26 11:49:18
问题 I want a div to slide in from the right in angular 2 using css. <div class=\"note\" [ngClass]=\"{\'transition\':show}\" *ngIf=\"show\"> <p> Notes</p> </div> <button class=\"btn btn-default\" (click)=\"toggle(show)\">Toggle</button> I works fine if i only use [ngClass] to toggle class and utilise opacity. But li don\'t want that element to be rendered from the beginning so I \"hide\" it with ngIf first, but then the transition wont\'t work. .transition{ -webkit-transition: opacity 1000ms ease