Skip to content

bug(mat-dialog): Interpolation and conditional don't work inside material dialogs in custom elements #21779

@gcherem

Description

@gcherem

Reproduction

Due the complexity to create the environment (custom elements running from an external web site), it is not possible to use StackBlitz to reproduce this issue.

Instead, I created the following repo: https://github.com/gcherem/custom-elements-bug

Steps to reproduce:

  1. run npm run build:elements in widget folder to build the scripts
  2. put widget/elements files in a web server (I used https://github.com/kzahel/web-server-chrome)
  3. double-click html/index.html (depending where you put the scripts, you may need to adapt index.html to find the scripts)
  4. click open modal button

Expected Behavior

Should show interpolated text and conditional structural (when satisfied) in material dialogs. By the other hand, everything works outside the dialog (main page).

Actual Behavior

Elements with interpolation {{ ...}} are not renderized at all. As well structural conditions (ngIf), even when the condition is true.

image

template

<div  class="mat-typography">
  <h2>Widget</h2>
  <p>line 1</p>
  <p>line 2: {{ variable }}</p>
  <p>line 3</p>
  <p *ngIf="show">line 4: This line also does not appear on modal</p>
  <p>line 5</p>
  <p>Cannot see lines 2 and 4 on modal</p>
</div>

PS.: No error reported at the console

Environment

  • Angular: 11.1.1
  • CDK/Material: 11.1.1
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOs Catalina

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: material/dialogneeds: clarificationThe issue does not contain enough information for the team to determine if it is a real bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions