6

I'm all new to Ionic, and this is my first project. I'm creating a little app with tab navigation in the bottom.

One tab view looks like this:

<ion-view title="Account">
  <ion-content class="has-header padding">
    <h1>Account</h1>
  </ion-content>
</ion-view>

I want to add a button in the header next to Account, and according to documentation you use the ion-nav-bar elements, but no button shows up when I try this. Can anyone give me a clue how to add buttons in the header, in a tab view?

1 Answer 1

20

You can make use of ion-nav-button like this:

<ion-view title="Account">
  <ion-nav-buttons side="left">
      <button class="button" ng-click="doSomething()">
        I'm a button on the left of the navbar!
      </button>
   </ion-nav-buttons>
  <ion-content class="has-header padding">
    <h1>Account</h1>
  </ion-content>
</ion-view>

Example 1 Example 2

Sign up to request clarification or add additional context in comments.

3 Comments

Do you know why it appears first after all page content have been loaded?
No, I did it just the way as in the code above, and it works, but it seems that the button appear first when the page has finished laoding. The title and header apears on the instant the page is visited but the button appears after.
It should load with the headers only, need to look into your code. Any controller method being invoked?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.