Topic: Hide/Show Modal in Typescript

Anas mohammed pro asked 6 years ago

how to hide/show the mdb modal in typescirpt?

Hualin Zhao priority commented 4 years ago


BruceVWilcox pro answered 5 years ago

The below link provided the answer to your question as I understood it.

The essential typescript code lines are shown below:

import { ModalDirective } from 'your path to modal directive';
@ViewChild('demoBasic') demoBasic: ModalDirective;
  showAndHideModal() {;


Damian Gemza staff answered 6 years ago

Hello salmansahnoon, You have to use in your componen.ts methods show() and hide() from ModalDirective. Here's the API Refference: Best Regards, Damian

Damian Gemza staff commented 6 years ago

You have to import ToastService into your component.ts file, and ToastModule in your app.module.ts. Then in imports array you have to import ToastModule.forRoot(). Best Regards, Damian

dtrunk90 free commented 3 years ago

How the ModalDirective should look like? Do I really need to create an extra file/class just to call the show/hide methods?

Arkadiusz Idzikowski staff commented 3 years ago

You can also call the methods directly in the HTML template. Please take a look at our examples:

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: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No