Open groogiam opened 4 years ago
Same. My work around is keeping states outside the <MatTabGroup>
. It will be nice to not lose state when switching tabs but I don't see a way to do that without having to just hide <MatTab>
content.
Seems like it might be a good feature to have a parameter to control how this renders.
Describe the question It seems that the MatTabGroup reinitializes its child controls each time a tab is switched. This means that the state of the control in the tab is completely wiped out. Is this by design? This essentially means that the control cannot be used for anything more than static content. E.g. if a tab group has two tabs with subcomponents that have forms switching essentially wipes out any in progress changes.
Blazorfiddle link The code below demonstrates this. The component is the standard component that is in the blazor template. In this example increment the counter, switch tabs and then switch back. You will see that the original counter is now reset to 0.
Expected behavior The state for tab child content should be maintained when switching tabs
Screenshots If applicable, add screenshots or .GIF captures to help explain your question.
Additional context Add any other context about the question here.