Importing MdbParallaxModule throws an error


Topic: Importing MdbParallaxModule throws an error

sterlingmichel pro premium priority asked 2 years ago

Expected behavior MdbParallaxModule successfully imports Actual behavior App crashes Resources (screenshots, code snippets etc.)

    Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:42:32 - error TS2564: Property '_imageContainer' has no initializer and is not definitely assigned in the constructor.

42   @ViewChild('imageContainer') _imageContainer: ElementRef<HTMLElement>;
                                  ~~~~~~~~~~~~~~~


Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:43:23 - error TS2564: Property '_image' has no initializer and is not definitely assigned in the constructor.

43   @ViewChild('image') _image: ElementRef<HTMLImageElement>;
                         ~~~~~~


Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:68:11 - error TS2564: Property '_observer' has no initializer and is not definitely assigned in the constructor.

68   private _observer: IntersectionObserver;
             ~~~~~~~~~


Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:227:25 - error TS7006: Parameter 'entries' implicitly has an 'any' type.

227   private _setIsVisible(entries): void {
                            ~~~~~~~


Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:228:22 - error TS7006: Parameter 'entry' implicitly has an 'any' type.

228     entries.forEach((entry) => {
                         ~~~~~


Error: code/plugins/mdb-angular-parallax/src/lib/parallax.component.ts:245:45 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'ParallaxStyle'.
  No index signature with a parameter of type 'string' was found on type 'ParallaxStyle'.

245       this._renderer.setStyle(el, property, styles[property]);
                                                ~~~~~~~~~~~~~~~~

What can I do to resolve this? This is just a normal import into app.module.ts


Arkadiusz Idzikowski staff answered 2 years ago

It looks like the module is imported from the code folder which contains the source code of our library and plugins. Please make sure to use this import path:

import { MdbParallaxModule } from 'mdb-angular-parallax';

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 3.0.1
  • Device: Macbook Pro 2021
  • Browser: Brave
  • OS: MacOS Ventura 13
  • Provided sample code: No
  • Provided link: No