I'm supposed to use this third party framework and have to initialize it after Angular has initialized.
I've tried adding it to my index.html:
<body>
...
<script>
document.addEventListener('DOMContentLoaded', () => {
console.log('DKFDS Initialized', DKFDS);
DKFDS.init();
});
</script>
</body>
but that doesn't work.
So I tried adding it to ngOnInit() in app.component.ts:
ngOnInit() {
document.addEventListener('DOMContentLoaded', () => {
console.log('DKFDS Initialized', DKFDS);
DKFDS.init();
});
}
still no luck :-(
The only way I can get it to work is by using jQuery to call the init() function:
ngOnInit() {
$(() => {
console.log('DKFDS Initialized', DKFDS);
DKFDS.init();
});
}
EDIT: I've also tried ngAfterViewInit() with the same disappointing result...
So my question is: How do I make this work in a pure Angular app without jQuery?
I've made a stackblitz to try to illustrate the issue. A menu should popup by clicking the "Overflow menu": https://stackblitz.com/edit/angular-ubsvkt
ngAfterViewInitbecasueDOMContentLoadedequivalent tongAfterViewInit