0

web fw: Angular 14

I have a code in script(.js) to fill up an element (div for example), now I need to use that element inside a mat-tab but I can't see it when mat-tab is not active (document.getElementById('elementId') returns null when mat-tab is not selected).Is there a way to change properties on mat-tab to allow access their content without activate it?

All works good when my element is outside mat-tab or if I set that mat-tab as active but I need to fill up the element when that mat-tab is not active.

  • You can not. mat-tab works using `*ngIf`... but you can simulate :), see this [SO](https://stackoverflow.com/questions/68129174/how-to-force-mat-tab-body-to-render-bind-html-element-for-inactive-tab/68129729#68129729) – Eliseo May 04 '23 at 18:36

0 Answers0