angular-animations: Angular 10 - Function calls are not supported in decorators but '' was called

I have created an Ionic 5 Angular 10 project and I am importing some animations as I have done for previous projects. However I am getting the error below. Any ideas what is causing this?
Similar code works fire with another Ionic 5 Angular 9 project I created.

Is this an Angular 10 issue or a typescript issue perhaps?

Error during template compile of ‘AppComponent’ Function calls are not supported in decorators but ‘slideInLeftOnEnterAnimation’ was called

If I remove the brackets I get the following error:

ERROR Error: Unable to resolve animation metadata node #undefined at visitDslNode (browser.js:554) at AnimationAstBuilderVisitor.build (browser.js:695) at buildAnimationAst (browser.js:685) at InjectableAnimationEngine.registerTrigger (browser.js:3856) at registerTrigger (animations.js:166) at Array.forEach (<anonymous>) at AnimationRendererFactory.createRenderer (animations.js:170) at createRootComponentView (core.js:18357) at ComponentFactory$1.create (core.js:22157) at ApplicationRef.bootstrap

    import { slideInLeftOnEnterAnimation } from 'angular-animations';

    @Component({
      selector: 'app-root',
      templateUrl: 'app.component.html',
      styleUrls: ['app.component.scss'],
      animations: [
        slideInLeftOnEnterAnimation()
      ]
    })
  Ionic CLI                     : 6.11.11
   Ionic Framework               : @ionic/angular 5.3.5
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3
   angular-animations": "^0.11.0

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 6
  • Comments: 18 (3 by maintainers)

Most upvoted comments

downgrading to version 0.0.10 works for angular 9. I was messing around for several hours.

Hi @madmacc,

The error in the editor is something I have come across. It should disappear once you compile the app e.g. run ng build.

The animation functions used in the decorator are statically analyzable and after the compilation, the errors should be gone and it shouldn’t cause any issues in the production build.

So far I haven’t found any solution for errors being shown in the editor until running the compilation step.