angular - how to open modal from component -
i want display modal component . have modal component created ng-bootstrap follow (just body):
<template id="accept" #content let-c="close" let-d="dismiss"> <div class="modal-body"> <p>modal body</p> </div> </template>
import { component } '@angular/core'; import { ngbmodal } '@ng-bootstrap/ng-bootstrap'; @component({ selector: 'my-hello-home-modal', templateurl: './hellohome.modal.html' }) export class hellohomemodalcomponent { closeresult: string; constructor(private modal: ngbmodal) {} open(content) { this.modal.open(content).result.then((result) => { this.closeresult = `closed with: ${result}`; }, (reason) => { console.log(reason); }); } }
i want able open modal component
see homecomponent
import { component, oninit } '@angular/core'; @component({ selector: 'my-home', templateurl: './home.component.html' }) export class homecomponent implements oninit { constructor() { } timer() { /** want open modal here . **/ } }
for myself use primeng dialog module component. can view here: https://www.primefaces.org/primeng/#/dialog
it easy use , looks nice , recommend it.
Comments
Post a Comment