Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters inside stagger() don't work #19786

Closed
heddendorp opened this issue Oct 18, 2017 · 14 comments
Closed

Parameters inside stagger() don't work #19786

heddendorp opened this issue Oct 18, 2017 · 14 comments
Labels
area: animations freq1: low P4 A relatively minor issue that is not relevant to core functions type: bug/fix
Milestone

Comments

@heddendorp
Copy link

heddendorp commented Oct 18, 2017

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When using an animation parameter inside stagger like stagger('{{ delay }}', [ the animation fails, because the parameter is not replaced.

Expected behavior

Parameters work inside stagger timings as well

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/SqrTDLrYKNaL8hTYHESj?p=preview
Create a stagger animation with an parameter inside the staggers timing

What is the motivation / use case for changing the behavior?

Parameter replacement works on other timing properties, it should work in stagger as well.

Environment


@angular/cli: 1.4.2
node: 8.2.1
os: darwin x64
@angular/animations: 4.4.5
@angular/cdk: 2.0.0-beta.12
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/flex-layout: 2.0.0-beta.9
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/material: 2.0.0-beta.12
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4


Browser:
- [x] Chrome (desktop) version 61.0.3163.100
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version 57.0b8
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

@manekinekko
Copy link
Contributor

manekinekko commented Oct 18, 2017

Hi, can you link to a plunkr online demo?

@matsko is this a known issue?

@heddendorp
Copy link
Author

I added a plunkr @manekinekko
Hope it's sufficient

@matsko
Copy link
Contributor

matsko commented Oct 23, 2017

Thank you for bringing this up. I will get to a fix shortly.

@elvisbegovic
Copy link
Contributor

it's me or this not working :

 trigger('ngIfAnimation', [
      transition(':enter, :leave', [
        query('@*', animateChild())
      ])
    ]),
    trigger('easeInOut', [
      transition('* => *', [ // each time the binding value changes

        query(':enter', [
          style({ opacity: 0 }),
          stagger(100, [
            animate('0.5s', style({ opacity: .5 }))
          ])
        ])
      ])
    ])
  ]

then in template simply use @easeInOut

@ngbot ngbot bot added this to the Backlog milestone Jan 23, 2018
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Feb 26, 2018
@artsys78
Copy link

Hi,

Parameters inside stagger() don't work.

When it would be fixed ?
The problem still persist.

Thank's

@sublimator
Copy link

super sad sad face

@tayambamwanza
Copy link

Please can this be fixed, I can't make re-usable animations for lists now.

@fattslug
Copy link

bump

1 similar comment
@Steven4294
Copy link

bump

@AsafAgranat
Copy link

BUUUMP.
Please kindly fix this. Much appreciated

@xe4me
Copy link

xe4me commented Aug 13, 2019

The entire Angular framework is on one side from being intuitive and reusable and simplicity and animation API is on another side. so so so unintuitive and unnecessarily complicated and weird. It's trying to follow functional programming while passing strings around as animation and I have to always look for examples because the docs make no sense and it's super tiring to read to be able to just create a simple fade animation with a variable passed in.
I'm sure even in Google devs try to avoid using it and resort to CSS animations instead.
What a disaster.
It's been 5? years since I started using Angular2, and my experience with animations API has been nothing but pain.
Can't believe it's been 5ish years since this API was announced, and it still does not support variables, wtf. That's like the most fundamental feature any animation library provides. 5 years

@tayambamwanza
Copy link

@xe4me I won't say that it doesn't have positives but for some reason I feel like animations isn't part of Angular, it's like a whole new language that I have to learn and a whole new way of thinking, so it ads extra learning curve.

@AsafAgranat
Copy link

@xe4me,

I'm sure even in Google devs try to avoid using it and resort to CSS animations instead.

Please keep your personal peeves out of this discussion. Angular animations is powerful and provides a ground for creating animations outside the scope of CSS. Even if its syntax is on the complex side (and you're welcome to suggest a better one), its still learnable and is highly useable (I use it incessantly in enterprise level apps).

Can't believe it's been 5ish years since this API was announced, and it still does not support variables

This is a grossly wrong statement. Variables are supported, and they work well. If you read this issue properly you'd realize that people ask for animations parameters would be supported inside stagger() function too, which currently they are not.

That's like the most fundamental feature any animation library provides.

Variables are not are not fundamental to "any animation library". Most frameworks provide APIs to create CSS animations. Angular animates DOM elements with timers, and not many frameworks provide this OTB.

@jelbourn jelbourn added P4 A relatively minor issue that is not relevant to core functions and removed severity2: inconvenient labels Oct 1, 2020
dario-piotrowicz added a commit to dario-piotrowicz/angular that referenced this issue Aug 21, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves angular#19786
dario-piotrowicz added a commit to dario-piotrowicz/angular that referenced this issue Aug 21, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves angular#19786
dario-piotrowicz added a commit to dario-piotrowicz/angular that referenced this issue Aug 21, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves angular#19786
alxhub pushed a commit that referenced this issue Aug 22, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves #19786

PR Close #47208
alxhub pushed a commit that referenced this issue Aug 22, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves #19786

PR Close #47208
@alxhub alxhub closed this as completed in 05f5e8a Aug 22, 2022
dario-piotrowicz added a commit to dario-piotrowicz/angular that referenced this issue Aug 23, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

(this PR reinstates the changes done in angular#47208 which have been reverted
because negative non-parametrized stagger values were not handled
correctly, alongside the original changes the current commit also
handles corretly negative non-parametrized values and improves unit
testing)

resolves angular#19786
dario-piotrowicz added a commit to dario-piotrowicz/angular that referenced this issue Aug 23, 2022
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

(this PR reinstates the changes done in angular#47208 which have been reverted
because negative non-parametrized stagger values were not handled
correctly, alongside the original changes the current commit also
handles corretly negative non-parametrized values and improves unit
testing)

resolves angular#19786
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: animations freq1: low P4 A relatively minor issue that is not relevant to core functions type: bug/fix
Projects
None yet