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

Ruth free asked 3 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)="" mdbWavesEffect>Launch Modal</button>

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

Arkadiusz Idzikowski staff answered 3 years ago

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

Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: 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