Angular powered Bootstrap. can help you here.
In your component you have to import NgbModal
and inject it in your Component, using the constructor. You can use this service to open the modal.
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@Component({ ... })
export class MyComponent implements OnInit {
constructor(private modalService: NgbModal)
{
}
ngOnInit() {
}
public show()
{
this.modalService.open('text');
}
}
This will open a modal, with message "text". But I guess that you may want to add a more complicated message. You can also put HTML inside your component's view, and use that.
<ng-template #wizard>
text
</ng-template>
Next inside your method you can add a reference to that template
@ViewChild('wizard')
public wizardRef: TemplateRef<any>;
public show()
{
this.modalService.open(this.wizardRef);
}
Now the content of the <ng-template #wizard>
will be shown inside the modal.
You can set more details using the NgbModalOptions
object, and specify it when calling the open(ref, options)
method.