preserveContent now added to mat-tabs?

2.4k Views Asked by At

Does anyone have a working example of this? I was originally implementing a solution similar to this answer here, but then saw that this feature was finally merged!

Does anyone have a working example of this? Our use case is having tabs that have functionality reliant on iframes on separate tabs persisting.

2

There are 2 best solutions below

0
marcusory On

Actually, I found examples here in the feature pull request.

It is as simple as <mat-tab-group contentPreserve="true"> However, now it is causing unexpected behavior in my tabs (might be related to this mentioned in the Docs: "One gotcha here is that we have to set visibility: hidden on the off-screen content so that users can't tab into it.") - now the iframe is loading further down the page and out of normal view. I will tinker around with the styling as that may be the cause since we made some tweaks to account for or previous workaround. Glad to see this being implemented now and would still be eager to see other people's use of mat-tab-group!

0
Rahul Bali On