Modal not showing close button

this is the modal page

home.html(the modal page)

<ion-header>
<ion-navbar>
    <ion-title>
        Feedback
    </ion-title>
    </ion-navbar>
</ion-header>

<ion-content class="home">

    ritesh is the best
         
</ion-content>

calling .ts file

let modal = this.modalCtrl.create(FeedbackPage);
    modal.present();

and i am calling this page as per ionic docs but the modal is not showing the close button…any suggestions

Hello,

i think you need to add button manually. This is how i managed to get a working close button:
//modal.html

  <ion-header>
	<ion-navbar>
		<ion-buttons>
			<button (click)="cancel()">
				<ion-icon name="close"></ion-icon>
			</button>
		</ion-buttons>
		<ion-title>title</ion-title>
	</ion-navbar>
</ion-header>

<ion-content padding>
	content
	
</ion-content>

//modal.ts

  cancel(){
    this.viewCtrl.dismiss();
  }

Hope it helps

1 Like

Instead of a custom function you can use “navPop” attribute like this ->

  <ion-header>
	<ion-navbar>
		<ion-buttons>
			<button navPop>
				<ion-icon name="close"></ion-icon>
			</button>
		</ion-buttons>
		<ion-title>title</ion-title>
	</ion-navbar>
</ion-header> 

See ref here

1 Like