Topic: MDBBootstrapModule.forRoot() in SSR mode

xxyyzz2050 free asked 5 years ago


I'm trying to import MDBBootstrapModule.forRoot() in app.module.ts (angular universal project)

and I build my project in SSR mode, but an error occured:

ReferenceError: window is not defined

 

->app.module.ts:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { DataComponent } from "./data/data.component";

import { MDBBootstrapModule } from "angular-bootstrap-md";

@NgModule({
declarations: [AppComponent, DataComponent],
imports: [
BrowserModule.withServerTransition({ appId: "serverApp" }),
AppRoutingModule,
MDBBootstrapModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}

 


Arkadiusz Idzikowski staff answered 5 years ago


Please use our Angular Universal guide to adjust your project files: https://mdbootstrap.com/docs/angular/getting-started/angular-universal/



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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.0.0
  • Device: ant
  • Browser: firefox & chrome
  • OS: windows & linux
  • Provided sample code: Yes
  • Provided link: No