Hide/Show Modal in Typescript


Topic: Hide/Show Modal in Typescript

salmansahnoon pro asked 7 years ago

how to hide/show the mdb modal in typescirpt?

Hualin Zhao pro premium priority commented 5 years ago

asdfasdfasdfasdf


BruceVWilcox pro answered 6 years ago

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

https://mdbootstrap.com/docs/angular/modals/basic/#show-and-hide

The essential typescript code lines are shown below:

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

 


Damian Gemza staff answered 7 years ago

Hello salmansahnoon, You have to use in your componen.ts methods show() and hide() from ModalDirective. Here's the API Refference: https://mdbootstrap.com/angular/advanced/modals/#advancedUsage Best Regards, Damian

Damian Gemza staff commented 7 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 commented 4 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 4 years ago

You can also call the methods directly in the HTML template. Please take a look at our examples: https://mdbootstrap.com/docs/angular/modals/basic/


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