show modal component on button click ionic code example

Example 1: ionic modal example

import { Component } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ModalPage } from '../modal/modal.page';

@Component({
  selector: 'modal-example',
  templateUrl: 'modal-example.html',
  styleUrls: ['./modal-example.css']
})
export class ModalExample {
  constructor(public modalController: ModalController) {

  }

  async presentModal() {
    const modal = await this.modalController.create({
      component: ModalPage,
      cssClass: 'my-custom-class'
    });
    return await modal.present();
  }
}

Example 2: ion modal toolbar

<ion-toolbar>
	<ion-title>Pesquisar médicos</ion-title>
    <ion-buttons slot="start">
      	<ion-button onclick="add_doc(null)">Cancelar</ion-button>
  	</ion-buttons>
</ion-toolbar>