Search code examples
ionic-frameworkpopover

how to add button in header to open popover in ion-view ionic?


I have to create popover in an ion-view page. I try this HTML code :

<ion-view view-title="Search">
 <div class="buttons">
  <button class="button button-icon ion-more" ng-click="popover.show($event)">
  </button>
  </div>
<ion-content >
</ion-content >
</ion-view>

But i didn't get the button in the header page. Any help is appreciated.


Solution

  • The button won't show up unless included in ion-header, ion-nav-buttons, ion-content. You can use the below to add the button to the header:

    <ion-nav-buttons side="right">
      <button class="button button-icon ion-more" ng-click="popover.show($event)">
      </button>
    </ion-nav-buttons>
    

    Also make sure popover is present on your scope