Running a Modal via the TS, in the constructor instead of t


Topic: Running a Modal via the TS, in the constructor instead of the HTML

Ruth asked 4 years ago

I want to call the modal from the constructor in the .ts, instead of calling it from the html. This is the example

<button type="button" mdbBtn color="default" rounded="true" data-toggle="modal" data-target="#basicExample"
  (click)="frame.show()" mdbWavesEffect>Launch Modal</button>

I'm trying to call frame.show() from the constructor, by adding @viewChild, it doesn't work...... Any idea ?


Arkadiusz Idzikowski staff answered 4 years ago

We explained how to create a dynamic modal in the modals documentation:

https://mdbootstrap.com/docs/angular/modals/basic/#dynamic


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 10.0.0
  • Device: i5
  • Browser: google chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No