Animation for newly rendered elements, but not on page load

前端 未结 4 1661
小鲜肉
小鲜肉 2021-01-05 12:35

I\'m subscribed to a Firebase real-time database so that when I submit something to it, it immediately renders in the view without any need for jQuery or ajax.

I\'d

4条回答
  •  庸人自扰
    2021-01-05 13:17

    Easiest solution:

     @Component({
        selector: 'myComponent',
        template: '
    ', animations: [trigger('someAnimation', [transition('* => *', [style({ transform: 'scale(1.1)' }), animate(250)])])] }) export class MyComponent implements AfterViewInit { disableAnimations: boolean = true; constructor() {} ngAfterViewInit(): void { this.disableAnimations = false; } }

    Reference: https://angular.io/api/animations/trigger (scroll to "disable animations")

提交回复
热议问题