Topic: Import MDB Pro into Angular library

SimonMorris free asked 4 years ago


Expected behavior

My Angular 10 project has a library and 3 applications, which use components from that library.

I want to use MDB Pro in the library components which are then displayed in the applications. However, when I import MDB Pro into my library I get a compilation error due to the use of forRoot

Actual behavior

During compilation with the --prod flag I get the following error

    Compiling TypeScript sources through ngc
ERROR: Error during template compile of 'ZontallyCommonModule'
  Function calls are not supported in decorators but 'MDBBootstrapModulesPro' was called.

An unhandled exception occurred: Error during template compile of 'ZontallyCommonModule'
  Function calls are not supported in decorators but 'MDBBootstrapModulesPro' was called.

Resources (screenshots, code snippets etc.)

My library module file

import { NgModule } from '@angular/core';
import { ZontallyCommonComponent } from './zontally-common.component';
import { MDBBootstrapModulesPro } from 'ng-uikit-pro-standard';

const ProModule = MDBBootstrapModulesPro.forRoot();

@NgModule({
  declarations: [ZontallyCommonComponent],
  imports: [
    ProModule
  ],
  exports: [ZontallyCommonComponent]
})
export class ZontallyCommonModule { }

Angular versions

"@angular/animations": "~10.0.6",
"@angular/cdk": "^10.1.2",
"@angular/common": "~10.0.6",
"@angular/compiler": "~10.0.6",
"@angular/core": "~10.0.6",
"@angular-devkit/build-angular": "~0.1000.5",
"@angular-devkit/build-ng-packagr": "~0.1000.5",
"@angular/cli": "~10.0.5",
"@angular/compiler-cli": "~10.0.6",

Arkadiusz Idzikowski staff answered 4 years ago


The latest version of MDB Angular is 9.3.1 and it is compatible with Angular 9. We don't support Angular 10 yet, but we plan to add updates in the near future.


SimonMorris free commented 4 years ago

Duh, yes... started a new project with Angular 9.1.3 and it works fine. Thanks!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 9.3.1
  • Device: Browser
  • Browser: Chrome
  • OS: Mac
  • Provided sample code: Yes
  • Provided link: No