halfmoon icon indicating copy to clipboard operation
halfmoon copied to clipboard

Using Halfmoon.onDOMContentLoaded() in Angular.

Open ghost opened this issue 5 years ago • 2 comments

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?

ghost avatar Dec 11 '20 15:12 ghost

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.

halfmoonui avatar Dec 14 '20 09:12 halfmoonui

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 [email protected]

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 [email protected], 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.

ghost avatar Dec 14 '20 09:12 ghost