Skip to content

Material Tabs with lazy loading are reinstantiated on tab clicks #16065

@FritzHerbers

Description

@FritzHerbers

What is the expected behavior?

After lazy loading a tab, the tab content should persist and not getting reinstantiated on tab changes.

What is the current behavior?

A tab change instantiates the new tab content and destroys the previous tab content.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-imxxnk

Click on the tabs and observe the console for ngOnInit and NgOnDestroy messages.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular 7.2.15
Material 7.3.7

Is there anything else we should know?

Using matTabContent: lazy loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions