How add one button in header with tabs template?

I start a app with tabs template.

I want to add one button in header bar.

Did this with Add button to header using tabs viee

but I got a error:

Error: [$compile:ctreq] Controller ‘ionNavBar’, required by directive ‘ionNavButtons’, can’t be found!

my pages are 3 level.

page1.html go to state page2.html and then goto state page3.html, i add the code into page3.html :

<ion-view view-title="XXX">
<ion-nav-buttons side="left">
    <button class="button" ng-click="doSomething()">
        MI
    </button>
</ion-nav-buttons>
<ion-content>

This error come out when I goto page2.html, but I still can enter page3.html. There is a little error on the UI, too. The back button text became “Back” not the title of page2.html.

If I refresh the page3.html only, there is no error.

I tried add that code in page2.html(not in page3.html), it’s worked and no error msg.

I don’t know what’s going on. Somebody can help me? Thaks a lot…

My mistake… :sweat_smile:

I used a modal in page2, but also page3 is one of modal.
Delete it, error msg is gone.