-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
needs triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team
Description
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
No response
Description
version 14.2.7
code here:
import { Component, Inject, ViewChild, ViewContainerRef, } from '@angular/core';
import { Dialog, DIALOG_DATA } from '@angular/cdk/dialog';
import { MatDialog, MatDialogConfig } from '@angular/material/dialog';
export interface DialogData {
animal: 'panda' | 'unicorn' | 'lion';
}
@Component({
selector: 'cdk-dialog-data-example-dialog',
templateUrl: 'cdk-dialog-data-example-dialog.html',
styleUrls: ['./cdk-dialog-data-example-dialog.css'],
})
export class CdkDialogDataExampleDialog {
constructor(@Inject(DIALOG_DATA) public data: DialogData) {}
}
/**
* @title Injecting data when opening a dialog
*/
@Component({
selector: 'cdk-dialog-data-example',
templateUrl: 'cdk-dialog-data-example.html',
})
export class CdkDialogDataExample {
@ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef;
constructor(public dialog: MatDialog, private viewContainerRef: ViewContainerRef) {}
openDialog() {
const dialogConfig = new MatDialogConfig();
dialogConfig.viewContainerRef = this.container;
const dialogRef = this.dialog.open(CdkDialogDataExampleDialog, dialogConfig);
}
}cdk-dialog-data-example.html
<button (click)="openDialog()">Open dialog</button>
<div #container>xxx</div>Reproduction
Steps to reproduce:
1.
2.
Expected Behavior
I want the dialog to mount to the specified dom instead of overlay.
Actual Behavior
MatDialog viewContainerRef invalid
Environment
- Angular: ~14.0.0
- CDK/Material: 14.2.7
- Browser(s): chrome
- Operating System (e.g. Windows, macOS, Ubuntu): window11
Metadata
Metadata
Assignees
Labels
needs triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team