1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to conditionally add animations in Angular 2

Discussão em 'Angular' iniciado por Devcon, Agosto 14, 2025.

  1. Devcon

    Devcon Guest

    I have a form component that has fields, some fields I want to animate when they appear in the form, but not every field.

    <div *ngFor="let field of form.Fields">
    <div [ngSwitch]="field.Type" [@slideOut]>
    <!-- more field stuff -->
    </div>
    </div>


    With other attributes I can do something like this [attr.required]="field.Required" But [attr.@slideOut] doesn't seem to work.

    Ideally I would like to have an animation property on my field so I could pass in animations like this [@field.Animation] but I can't find any documentation on how I would do anything like this. Any ideas?

    Continue reading...

Compartilhe esta Página