import { Component, OnInit } from '@angular/core'; import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal'; @Component({ selector: 'demo-modal-service-component', templateUrl: './service-component.html' }) export class DemoModalServiceFromComponent { bsModalRef: BsModalRef; constructor(private modalService: BsModalService) {} openModalWithComponent() { const initialState = { list: [ 'Open a modal with component', 'Pass your data', 'Do something else', '...' ], title: 'Modal with component' }; this.bsModalRef = this.modalService.show(ModalContentComponent, {initialState}); this.bsModalRef.content.closeBtnName = 'Close'; } } /* This is a component which we pass in modal*/ @Component({ selector: 'modal-content', template: `