the scenario is simple, so i have navigation menu (ex : Home, About Me, etc) on the left side and a container in right side. when i click the navigation menu, i want to show a template in my container side.
Just an example if i click “Home” in my navigation menu, then the container side will display Home Template. or if i click “About Me” menu, then the container side will display AboutMe Template.
i want to make it with a reactive menu using meteor session.
i cant give all my code here because its too long, so here is my essential code
I am not an expert (I still need to try it for first time) , but Iron Router is ment exactly to do that with yelds and regions. Anybody, correct me if I am wrong.
And of course (maybe the most potential and easiest way of meteor for creativity): conditional IF in a template. If a session variable changes, whatever template monitoring it will re-render.
My problem is solve now… i took scmart advice and do some random lucky modification in MainTemplate…
i was thinking that maybe the list in <ul> is not a part of MainTemplate because of css. so i decided to seperate it from MainTemplate and put it into new template.
I am about to program such things in Meteor for first time, so not experimented yet. But in my understanding: At the router level, not hard coded in several templates of the same thing, the router can define the data context and even the template used.
But for a changing template (such as an acordeon opening depending on a variable state, I would put it in a IF in the template if the different templates are a different display of the same functional thing in the application, so when you look at template code, you have the whole picture of its behavior, rather than spread across several templates.
If the templates relate to different functional elements of the site, I would go Router side also because you can at the same time select data context for it, outside of templates so templates do not hard code data context.
The great thing I understand about the router is that we can make templates that are more one-template-fits-all. (especially multilingual)
Sorry, in the link you provided, there are 3 options for multi-level push menus, each with a Demo. The second Demo is named ‘Covering levels’. To me it seems the best option and I’d love to build something like this into my application.
I was wondering which method you were implementing and if you had code to share to get me started building something like this into my Meteor application.