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

fix(sidenav): first animation not working in Angular 4.2+ #5821

Merged
merged 1 commit into from Jul 20, 2017

Conversation

crisbeto
Copy link
Member

Fixes the first opening/closing animation not working in newer Angular versions. The issue is due to the fact that Angular no longer evaluates the _enableTransitions binding after we've set it in the microtask empty callback. These changes switch to setting the class directly, which also has the advantage of being a little more compact.

Fixes #5673.

Fixes the first opening/closing animation not working in newer Angular versions. The issue is due to the fact that Angular no longer evaluates the `_enableTransitions` binding after we've set it in the microtask empty callback. These changes switch to setting the class directly, which also has the advantage of being a little more compact.

Fixes angular#5673.
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 17, 2017
@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Jul 17, 2017
@kara kara merged commit 804f4c0 into angular:master Jul 20, 2017
// Give the view a chance to render the initial state, then enable transitions. Note that we
// don't use data binding, because we're not guaranteed that newer version of Angular will
// re-evaluate them after we set the flag here.
first.call(this._ngZone.onMicrotaskEmpty).subscribe(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what AfterViewInit is for? just wondering. Wouldn't want to have to do this in my own components

Copy link
Member Author

@crisbeto crisbeto Jul 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main point of this is to defer the animation until the next change detection cycle, because we don't want sidenavs to animate in on load. Setting the flag in AfterViewInit is still a little too early. This should be easier in Angular 4.3 with the [@.disabled] bindings.

@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

regression - sidenav first animation skipped
5 participants