Topic: how to put the modal code in an extra component
just gischy asked 7 years ago
hello,
i have an application, app.component.html hold the structure of the main page. currently my modals are also inside the app.component.html...
now the application gets slow because huge modals are rendered when calling the app.component.html even if they are not shown...
how can i seperate my modal code into an extra component? as a result i want the modals be rendered just when they are called to show..
thanks in advance!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No
Damian Gemza staff commented 7 years ago
Dear just gischy, It's simple to achieve. Just create another component, put there code of your desired modal, and in your app.component make some *ngIf directive to check, if modal should be shown or not. Best Regards, Damianak.leimrey pro commented 7 years ago
Well, as you create ANY component. Create a modal component, that is solely responsible for the modal content and call it in your app.component.html like "<app-modal-content></app-modal-content>