Topic: navbar.nativeElement.append is not a function in Angular Univeral

Hosboss pro asked 6 years ago

We use the PRO version together with Angular Universal (Express Framework). When delivering our app, the following error message is issued by the server: ERROR TypeError: l.navbar.nativeElement.append is not a function
It's the same problem as this :

Merci de votre aide !

Damian Gemza staff commented 6 years ago

Dear Turki, could you provide me some reproduction steps? We're not fully compatible with Angular Universal, we have this in our plans to the nearest future. Best Regards, Damian

Hosboss pro commented 6 years ago

Hi Damian, I followed the steps of this tutorial: and I get the error message when I run the command node dist/server.js It's very important, even essential, for me I can not use it for my site if SEO is not possible. Thanks, Best Regards

Damian Gemza staff commented 6 years ago

Turki, I've downloaded repo from this tutorial, added MDB to it and pasted sample code from navbar. Then ran this out, and I see no errors there. Could you send me your project without node_modules at ? Best Regards, Damian

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

Damian Gemza staff answered 6 years ago

Dear Turki, Sorry for so much respond time. I've got fix for this problem. Please head into /free/navb ars/navbar.component.ts and: In constructor change type of renderer from Renderer to Renderer2 then find line:
and change it to
this.renderer.appendChild(this.navbar.nativeElement, child);
And now it should works fine. Let me know if there's more problems. Best Regards, Damian  

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: Yes