Atif Azad
Atif Azad

Reputation: 85

How to open ng-bootstrap modal popup on pageload in angular 7?

I am unable to display the ng-bootstrap modal popup on page load in angular 7.

i have tried the below code to open it.

openVerticallyCentered(content) {

this.modalService.open(content, { centered: true });.
this.modalService.open(content, { beforeDismiss: false });

}

Upvotes: 3

Views: 4550

Answers (1)

gkhnclk
gkhnclk

Reputation: 174

You should use ViewChild decorator to reach content on init.

Demo here. https://stackblitz.com/edit/angular-rd8tny?embed=1&file=app/modal-basic.ts

Upvotes: 8

Related Questions