Open everythingbytesnz opened 3 years ago
Hey @everythingbytesnz 👋
Can you please create a minimal reproduction repo in GitHub and post it in the issue summary? There's a lot of variables in play here, and a minimal reproduction helps us confirm things like your stencil compiler settings, library version(s), etc. Thanks!
Thanks!
@rwaskiewicz Hi was the issue able to reproduced using my example, please?
Hey @everythingbytesnz, I was able to reproduce your issue, but haven't had a moment to dig deep into the root cause. If your implementation is similar in nature to the reproduction, I can offer you a workaround for the time being - in your defineCustomElements
call in your Angular application, wrapping the call in setTimeout
seems to work for now:
// https://github.com/everythingbytesnz/stencil-ionic-menu-bug/blob/master/angular-app/src/main.ts#L20
- defneCustomElements();
+ setTimeout(() => defineCustomElements(), 0);
some folks are working on the docs around Angular integration as we speak, so we hope to identify some of these rough edges a bit better in the very near future and get them on our roadmap to both improve the docs and root cause issues like this.
That workaround works perfectly, thank you very much you've unblocked me.
Stencil version:
I'm submitting a: [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior: @ionic/angular MenuController commands can't find any ionic menu programmatically when I add defineCustomElements(); to my main.ts.
The menu can be opened if I add an ion-menu-button element to the UI. https://ionicframework.com/docs/api/menu-button.
I didn't use this solution because we have 3 menus and we have a lot of code to programmatically hide and show them using menuController.open() menuController.close() etc.
Expected behavior: MenuController should be able to open a ion-menu component in my angular app with this.menuController.open().
Steps to reproduce:
Related code:
app.component.html
app.component.ts
This code should return an array of ionic menu elements but instead returns an empty array.
This code should open a menu but it doesn't, there is no change to the UI.