32

After migrating from Angular 4.3.5 to 4.3.6 something with animations went bad (with 4.3.5 was everything alright).

The problem is that, when the application starts, the login component is loaded, and that component has fadeIn animation to show up. After upgrade to the latest angular version, my component is hidden always after the application is loaded. I inspected the login component and found that it has style="display: none"; applied.

I am using external animations.ts file to store all my animations.

animations.ts

import { animate, state, style, transition, trigger } from '@angular/animations';

// Fade In Animation
export const fadeIn = trigger('fadeIn', [
    transition('void => *', [
        style({ opacity: 0 }),
        animate(500, style({ opacity: 1 }))
    ])
]);

login.component.ts

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { AuthenticationService } from '../../services/authentication.service';

import { fadeIn } from './../../shared/animations/animations';

@Component({
    moduleId: module.id,
    selector: 'app-authentication',
    templateUrl: './authentication.component.html',
    styleUrls: ['./authentication.component.css'],
    animations: [fadeIn]
})

export class AuthenticationComponent implements OnInit {

    constructor(private router: Router, private authenticationService: AuthenticationService) {}

    ngOnInit() {}
}

login.component.html

<div class="container" [@fadeIn]>
    <div class="loginContainer">
        <div class="loginHeader">Login</div>
        <form name="loginForm" #loginForm="ngForm" (ngSubmit)="loginForm.form.valid && logIn()" novalidate>
            <div class="loginBody">
                <span>content</span>
            </div>
        </form>
    </div>
</div>

The strangest part is even if I remove [@fadeIn] from HTML, my component is loaded hidden. Only after I remove animations: [fadeIn], from login.component.ts, then my login form shows up, just without any fadeIn animation.

NOTE: I am using [@fadeIn] without any expressions. But till 4.3.5 version it was working just fine.

Any suggestions guys?

Sohail Ahmad
  • 7,309
  • 5
  • 27
  • 46
Null
  • 518
  • 7
  • 13
  • did you try `@fadeIn` without the brackets on your container? `
    `
    – Poul Kruijt Aug 29 '17 at 10:56
  • already tried and no success – Null Aug 29 '17 at 11:17
  • Hi Dance, Any news regarding this bug ? Same problem here if I edit the angular version : https://plnkr.co/edit/Uo1coU9i1GsB1I4U3809?p=preview – sebastienbarbier Sep 13 '17 at 15:45
  • No news yet. actually waiting for next version release. But I've checked your plunker with versions 4.3.1 - 4.3.6. Seems only 4.3.3 is not working. The latest 4.3.6 is working well. – Null Sep 13 '17 at 16:34
  • Really ? I have a bug using 4.3.6 ... See updated version : https://plnkr.co/edit/NPxUhgvRXbw2Kwdcq1H4?p=preview and try going to about, then back home :( – sebastienbarbier Sep 14 '17 at 08:17
  • Plunker works if using 4.3.6 everywhere but keep 4.3.1 on @angular/animations/browser ... that's weird. – sebastienbarbier Sep 14 '17 at 09:01
  • Yeah you are right. With 4.3.6 when i go back to Home from About page, Home page just disappear. I've inspected code and found that the problem is the same as in my case. The Home component got `display: none` Inspected home component: `` – Null Sep 14 '17 at 10:42
  • There's an open issue on github: https://github.com/angular/angular/issues/18923 which is probably the best place to stay updated on this regression status. – Z. Bagley Sep 15 '17 at 12:36
  • Seems Angular was updated to 4.1.1 and animation problems were fixed. Also this plunk with 4.1.1 seems working fine: https://plnkr.co/edit/NPxUhgvRXbw2Kwdcq1H4?p=preview – Null Sep 18 '17 at 06:59

1 Answers1

1

Angular seems to fix issues with animation after version 4.4.1. Updating to 4.4.1 should resolve the issue.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Null
  • 518
  • 7
  • 13