fabiandev / css-animator

Animate elements using CSS classes with support for Angular.

Home Page:https://fabiandev.github.io/css-animator/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected value AnimatesDirective

opened this issue · comments

Using Angular-cli, when I try to build for production, the following error pops up..

ERROR in Unexpected value 'AnimatesDirective in app.module.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'

I haven't tested this package with the angular-cli yet. Also, did you have a look at angular/angular-cli#4551 and angular/angular-cli#5596?

With the given error I cannot really say if css-animator causes it, or if it's something else. Probably you can post your app.module.ts, so I can have a look.

I just checked https://angular.io/docs/ts/latest/cookbook/aot-compiler.html and it seems this package is not AoT compliant. I will push an update asap, in the meantime you can use it without ahead of time compilation. I'll keep you posted.

Just in case, please post you app.module.ts anyway.

Hi,

Here's a snippet of my module file.

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AnimatesDirective, AnimationService } from 'css-animator';
import { MaterializeModule } from 'angular2-materialize';

import { AnswerDirective } from './directives/answer.directive';
import {
    .
    .
    NotificationComponent
} from './components';

import {
    .
    .
    LocalizationService
} from './services';

@NgModule({
    imports: [
        CommonModule,
        MaterializeModule
    ],
    declarations: [
        .
        .
        AnimatesDirective,
        AnswerDirective,
        NotificationComponent
    ],
    providers: [
        .
        .
        LocalizationService
    ]
})
export class TesterModule {
}

I've finally added support for AOT compilation with Angular as of v2.1.0 of this package.

When you upgrade to the latest version of css-animator, please make sure to just import AnimatorModule and that you don't add AnimatesDirective to the declarations, or AnimationService to the providers of your module. It should look similar to the code below.

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AnimatorModule } from 'css-animator';
// ...

@NgModule({
  imports: [
    CommonModule,
    AnimatorModule,
    // ...
  ],
  declarations: [
    // ...
  ],
  providers: [
    // ...
  ],
})
export class MyModule { }

awesome! much appreciated.