#Angular dynamically opening popup material

2 messages · Page 1 of 1 (latest)

humble wren
#

Hi,
I'm searching for a working example I tried the following:
import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';

@Component({ selector: 'app-root', template:
<button mat-button (click)="openDialog()">Open Dialog</button>
`,
})
export class AppComponent {
constructor(private dialog: MatDialog) { }

async openDialog() {
const { DynamicDialogComponent } = await import('./dynamic-dialog/dynamic-dialog.component');
this.dialog.open(DynamicDialogComponent, {
data: {
title: 'Dynamic Title',
content: 'This is dynamic content passed to the dialog.',
},
});
}
}`

but when I try this with a component, the component is not found

mystic flare