Skip to content

bug(material/tabs): Change Detection for tab content that lazy loaded does not works #31639

@bobah2000

Description

@bobah2000

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

16

Description

If tab content is lazy loaded by declaring the body in a ng-template with the matTabContent attribute then Change Detection in this content does not works as expected.
At the same time if exactly this content is earer loaded, then Change Detection work fine.
Problem occurs only when in tab content used traditional data binding. With signal no problem.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-eryh6yyk

First three tabs has the same component with traditional data binding as content. The last tab has component with signals as content.

Steps to reproduce:

  1. Click "Start loading" button on first tab. Progress bar will be appeared.
  2. Switch to second tab and click "Start loading" button. Progress bar will NOT be appeared.
  3. Switch back to first tab and click "Start loading" button. This time progress bar will NOT be appeared.
  4. Switch to third tab which content is eager loaded. Here all works as expected. Progress bar will be appeared.
  5. Switch to fourth tab which content is lazy loaded, but there signals are used. Here also all fine. Progress bar will be appeared.

Expected Behavior

The change detection in components which is used as lazy loaded content of MatTab works.

Actual Behavior

The change detection in components which is used as lazy loaded content of MatTab does not works.

Environment

  • Angular: ^19.2.0
  • CDK/Material: ^19.2.19
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions