import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; constructor(private modalService: NgbModal) {} openModal(content) { this.modalService.open(content); }
import { Component } from '@angular/core'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'app-modal-example', template: `This example creates a ModalExampleComponent which contains a button that, when clicked, launches a modal window containing the specified HTML template. The modal window includes a title, body, and footer section, as well as buttons to close the window. The modalData variable is used to display the text in the body section of the window. The open() method also includes a then() function to log the results of the user's interaction with the modal.`, }) export class ModalExampleComponent { modalData = 'Hello, world!'; constructor(private modalService: NgbModal) {} open() { this.modalService.open(this.myModal).result.then((result) => { console.log(result); }, (reason) => { console.log(reason); }); } } Modal Title
{{modalData}}