Be able to set leftButtons/rightButtons directly on navbar?


#1

Is this at all possible? If it is, it would definitely make code more DRY in this app I’m building.

Being able to set the buttons at the very top level instead of on the individual pages would be awesome, and even more awesome if the arrays they’re in could be accessed and modified from a child scope. That way, you could always have buttons appearing on every page, but use Array.prototype.push or Array.prototype.unshift to add more buttons for specific pages.


#2

Sure, I like the idea. Would you be able to create an issue in the repo, describe exactly how you think it should work and label it as an enhancement? thanks


#3

For example, I want a 3 bars button on the header to toggle the left side menu. Currently, I need to add “left-buttons=‘leftButtons’” on every views. Now I would like dry it up: Set the left-buttons only once and have it available in every views. Is it possible now? If not, never mind.


#4

You could simply have a main controller (or better yet a service) that stores the buttons. Then, each controller can modify them as necessary. This would best be done as a service, but this example shows how an overriding “AppController” could hold all the button info and then each view/scope will be able to access them.


#5

Yes, but you are repeating “left-buttons=“leftButtons”” on every views, right? That’s what I wanted to dry up.


#6

True - sorry missed that point. I thought you were just trying to avoid creating them in each controller. As Adam asked then, please create an issue / feature request on GitHub.