zefoy / ngx-perfect-scrollbar

Angular wrapper library for the Perfect Scrollbar
MIT License
523 stars 116 forks source link

AOT compilation error with PerfectScrollbarModule.forRoot #17

Closed stephane-dereppe closed 7 years ago

stephane-dereppe commented 7 years ago

I got the following error when I start ng serve (angular cli v beta.24) with the perfect scroll bar

ERROR in Error encountered resolving symbol values statically. Calling function 'PerfectScrollbarModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in myapp/src/app/app.module.ts, resolving symbol AppModule in myapp/src/app/app.module.ts

I've already had the same problem with other lib (ng2-translate for instance) but upgrading to the laster version resolved the problem...

Could you fix this also for the perfectscrollbar?

Thanks

sconix commented 7 years ago

Latest version already works with AOT and angular 2.4. We also use angular-cli v24 in our project and this libs works without problems.

stephane-dereppe commented 7 years ago

Here is the version of the perfectscrollbar that I use : cat node_modules/perfect-scrollbar/package.json => version": "0.6.15"

Here is my package.json dep part

"dependencies": {
    "@angular/common": "2.4.1",
    "@angular/compiler": "2.4.1",
    "@angular/core": "2.4.1",
    "@angular/forms": "2.4.1",
    "@angular/http": "2.4.1",
    "@angular/platform-browser": "2.4.1",
    "@angular/platform-browser-dynamic": "2.4.1",
    "@angular/router": "3.4.1",
    "core-js": "^2.4.1",
    "rxjs": "5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2",
    "@angular2-material/progress-bar": "2.0.0-alpha.8-2",
    "angular2-perfect-scrollbar": "^1.1.0",
    "bootstrap": "3.3.7",
    "jquery": "3.1.1",
    "ng2-toasty": "2.2.2",
    "ng2-translate": "5.0.0",
    "ts-smart-logger": "0.0.4"
  },
stephane-dereppe commented 7 years ago

Here is how I load the module :

const PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
  suppressScrollX: true
};

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        ...
        PerfectScrollbarModule.forRoot(PERFECT_SCROLLBAR_CONFIG)
    ],
sconix commented 7 years ago

Latest version is 2.0.2 and you are usimg 1.x. AOT compatibility was added on 2.0.

stephane-dereppe commented 7 years ago

Thanks a lot for the quick response. It did the trick !

My error was because I didn't see any release on the githup repo...