Topic: Server side rendering (universal) impossible. (KeyboardEvent/MouseEvent/window/Event)

Hosboss pro asked 6 years ago


Hello, Do you have a fix for the rendering problem with server with universal. For a website this is essential for SEO, is makes mdboostrap angular unusable in this case. Thank you.

Lesther Caballero pro commented 6 years ago

I found a temporary solution. Go to the carousel folder=>carousel.components.ts, search for the word "KeyboardEvent" (line 428) which is an interface and replace it for "any"

Hosboss pro commented 6 years ago

Thank you for your answer, but it only partially answers the problem (I already solved this by placing a replacement in the webpack config test: /.(ts|js)$/, loader: 'regexp-replace-loader', options: {match: {pattern: '\ [(Mouse | Keyboard) Event \]', flags: 'g'}, replaceWith: '[]',} But that does not solve window problems for example, I am forced to rewrite the components as for example for sidenav: // pobraneie szerokosci okna po init if (isPlatformBrowser (this.platformId)) { // Client only code. this.windwosWidth = window.innerWidth; } if (isPlatformServer (this.platformId)) { // Server only code. .... } But I can not do this for all the compenents that will take too much time and I would lose the benefits of having paid a license to avoid me just that. But thanks again.

Damian Gemza staff answered 6 years ago


Guys, we're ready to official announce, that our MDB Angular is now compatible with Angular Universal (Server-Side Rendering). Feel free to update your project to latest 5.2.3 version and enjoy it! Best Regards, Damian

carloscabanita pro answered 6 years ago


i have the same problem MDB Angular with Angular Universal "ReferenceError: Event is not defined"

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: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags