I am trying to add a button to my navigation on certain pages. However, with the seed project I only get to set the title on each page.
<ion-view title="'Items'">
How do I add a button to the navigation?
I am trying to add a button to my navigation on certain pages. However, with the seed project I only get to set the title on each page.
<ion-view title="'Items'">
How do I add a button to the navigation?
You can specify <ion-view title="'Items'" left-buttons="leftButtons" right-buttons="rightButtons"> </ion-view>
Where leftButtons
and rightButtons
are scope variables where you can assign buttons and what happens when you tap them as a list of objects in your controller.
Docs: http://ionicframework.com/docs/angularjs/controllers/view-state/
Maybe a change has occurred since this answer was given, but if you want to conditionally add buttons to the navbar based on a given page all you need to do is add the ion-nav-buttons directive inside you view but above you content.
<ion-view view-title="Buddy List">
<ion-nav-buttons side="right" ng-show="false">
<button class="button button-icon button-clear ion-compose">
</button>
</ion-nav-buttons>
<ion-content>
<h1>Buddy List</h1>
</ion-content>
</ion-view>