Add animation query() functionality
See original GitHub issue@Component({
selector: 'app',
styleUrls: ['app.css'],
template: `
<button (click)="exp=!exp">Go</button>
<div class="trigger" [@container]="exp" *ngIf="exp">
<header #header [@header]="exp ? 'true' : 'false'">header</header>
<div #body>body</div>
<footer #footer>footer</footer>
</div>
`,
styles: [`
.trigger {
display:block;
padding:1em;
border:10px solid #888;
}
.item {
width:100px;
line-height:100px;
font-size:60px;
border:10px solid black;
display:inline-block;
margin:10px;
text-align:center;
}
`],
animations: [
trigger('header', [
state('true', style({ backgroundColor: 'red' })),
state('false', style({ backgroundColor: 'blue' })),
transition('* => *', animate(2000))
]),
trigger('container', [
state('*', style({ opacity: 1 })),
state('void', style({ opacity: 0 })),
transition(':enter', group([
query('footer', [
style({ opacity: 0 })
animate(2000, style({ opacity: 1 }))
]),
query('header', animateChild()),
query('body', [
style({ opacity: 0 })
animate(2000, style({ opacity: 1 }))
])
])),
transition(':leave', [
animate(500)
])
])
]
})
export class App {
public exp = false;
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:15 (8 by maintainers)
Top Results From Across the Web
query - Angular
Finds one or more inner elements within the current element that is being animated within a sequence. Use with animate() . query(selector: ...
Read more >Angular.io v8: animate object and query()-children simple and ...
query finds one or more inner elements within the current element that is being animated within a sequence. Use with animate(); transition and ......
Read more >jQuery Effects - Animation - W3Schools
The jQuery animate() method is used to create custom animations. Syntax: ... By default, jQuery comes with queue functionality for animations.
Read more >In-Depth guide into animations in Angular - InDepth.Dev
Angular animation comes with a handy function called animateChild() which as the name suggests, executes the child's animation. You might be ...
Read more >Practical, real-world animation examples with Angular
The animate() function accepts the timings and styles input parameters. In our example, because our styles are defined in the state() function, we...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This will be a new method call to
stagger(delay, animation). This way it’s easier to handle preparation styles (which site outside of where stagger() is used).Once query is in place then having basic staggering support is a super tiny feature to add so it will likely go in within the same release.
It’s getting close: https://github.com/angular/angular/pull/15574