I'm grappling with how to handle the menu in my app, which remains consistent across all pages/views, while the sub menu varies depending on the main page/view. Currently, I have both menus placed in the body
, along with an ng-view element.
Initially, I considered creating a controller for the sub menu and looping through an array of sub-pages to display. However, this approach seems complex and counterintuitive since I would need to maintain a separate list of sub-pages for each main page within the controller. This arrangement doesn't align with the logic of the main pages/views, does it?
Alternatively, I've come across angular ui router and its nested views implementation. Should I consider treating the sub menu as a nested view instead?
While I understand that sharing actual code can be helpful, my challenge lies more in defining the best approach rather than implementing it. It strikes me that adjusting a sub menu based on different page/views must be a common issue, so there are likely recommended solutions available.