@ng-bootstrap/ng-bootstrap npm I m using for this as in the project bootstrap is used, for material, we used dialog
HTML Code
<span (click)="openModal(modalRef)" class="form-control input-underline pl-3 ">Open Abc Modal
</span>
Modal template
<ng-template class="custom-modal" #modalRef let-c="close" let-d="dismiss">
<div class="modal-header custom-modal-head"><h4 class="modal-title">List of Countries</h4>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<img src="assets/actor/images/close.png" alt="">
</button>
</div>
<div class="modal-body country-select">
<div class="serch-field">
<div class="row">
<div class="col-md-12">
<input type="text" class="form-control input-underline pl-3" placeholder="Search Country"
[(ngModel)]="countryWorkQuery" [ngModelOptions]="{standalone: true}">
<ul *ngIf="countries" class="ng-star-inserted">
<li (click)="setSelectedCountry(cntry, 'work');d('Cross click');" class="cursor-pointer"
*ngFor="let cntry of countries | filterNames:countryWorkQuery ">{{cntry.name}}</li>
</ul>
<span *ngIf="!modalSpinner && (!countries || countries.length<=0)">No country found</span>
<span *ngIf="modalSpinner" class="loader">
<img src="assets/images/loader.gif" alt="loader">
</span>
</div>
</div>
</div>
</div>
</ng-template>
Ts File
import {NgbModal, ModalDismissReasons} from '@ng-bootstrap/ng-bootstrap';
constructor(
private modalService: NgbModal
) { }
openModal(modalContent){
this.modalService.open(modalContent, { centered: true});
}