Over the last couple of months, I’ve been trying to optimize the use of modals in my project. The project uses Semantic UI, which has a nice set of components implemented with jQuery.
If you check out my hackpad again, I did a tiny edit some time ago – instead of parent_view = template.view.parentView it is now parent_view = template.parent().view.
This is a straight bug-fix, but it relies on the aldeed:template-extension package for the parent() function, which finds the proper parent template’s view.
Try to edit your pad (or make it publicly editable) and let me know
Also, you have to destroy the Blaze View in the onHidden hook for the modal – I’m sure Foundation has something similar to Semantic’s – or there will be more and more hidden modals in the view hierarchy, leaking DOM nodes.
Thanks for taking the time to try this method out, btw.
Thanks Deb - I’ll take a look a bit later and update. I’m not seeing a way to make the meteorpad publicly editable, but it looks as if you can fork it.
Is there any way of passing parameters to the modal from the template?
In a “traditional” way, you could add for example some attributes to the a/button/input element that’s triggering it, but with this way any parameters you add to the {{#appModalOpen}} go to the appModalOpen template instead of the final template, so inside the modal you don’t what triggered it…