halfmoonui / halfmoon

Halfmoon is a highly customizable, drop-in Bootstrap replacement. It comes with three built-in core themes, with dark mode support for all themes and components.
https://www.gethalfmoon.com
MIT License
3.04k stars 118 forks source link

Using Halfmoon.onDOMContentLoaded() in Angular. #80

Open ghost opened 3 years ago

ghost commented 3 years ago

Hello there. I used Halfmoon in many components, and many of them required halfmoon.js to work. I initially managed this by:

import * as halfmoon from 'halfmoon' ngOnInit() { halfmoon.onDOMContentLoaded() } in my app.component.ts (parent of all the components).

This works till you refresh the page, but it doesn't work with Angular Routing. Is there a better way to manage this and start halfmoon.js without writing halfmoon.onDOMContentLoaded() in every child component?

halfmoonui commented 3 years ago

Hey, yeah I got this wrong in the documentation. The halfmoon.onDOMContentLoaded() should be called during the first load, and after every time the route changes for SPAs. I will update this as soon as I can, and I am also looking to write a proper docs page for integrating Halfmoon with Angular.

ghost commented 3 years ago

That’s amazing mate. It was a bit painful and frustrating working with Halfmoon and Angular 😂 Let us know!

Pietro Lungarini Web Designer & Developer

T: +39 334 9447086 pietro@lungarini.it

Prima di stampare questa mail, pensa all'impatto sull'ambiente. Please consider the environment before printing this e-mail. Il 14 dic 2020, 10:16 +0100, Halfmoon UI notifications@github.com, ha scritto:

Hey, yeah I got this wrong in the documentation. The halfmoon.onDOMContentLoaded() should be called during the first load, and after every time the route changes for SPAs. I will update this as soon as I can, and I am also looking to write a proper docs page for integrating Halfmoon with Angular. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.