Topic: Modal open at start

jay2jam pro asked 5 years ago


Hello,

how can i open a modal at start, so without clicking on a button

Thx

Stefan


jay2jam pro answered 5 years ago


@Arkadiusz Idzikowski

Thank you it is working.

Merry christmas to you :-)


Arkadiusz Idzikowski staff answered 5 years ago


Hello,

There are two ways to achieve this:

1. Using the basic example

Copy the html code from the basic example, then in your ts file use ViewChild decorator to get access to the 'basicModal' template variable.

@ViewChild('basicModal') basicModal: ModalDirective;
 
Then you can use show method to open modal in AfterViewInit hook:
 
ngAfterViewInit() {

  this.basicModal.show();

}
 
2. Using dynamic modal
 
Follow the instructions from the documentation and use modal service 'show' method to open modal whenever you need to.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.0.0
  • Device: Mac
  • Browser: Chrome
  • OS: Mojave
  • Provided sample code: No
  • Provided link: No