Angular 7.1 , AngularMaterial 7.3
I am trying to call function and pass some value, It prompt following error
No component factory found for t1. Did you add it to @NgModule.entryComponents?
Although t1
is included in entryComponent
. but once remove passing value to fix value it will work.
<button mat-button (click)="openDialog('t1')">T1</button>
<button mat-button (click)="openDialog('t2')">T2</button>
Once I pass value its show the above code.
openDialog(e) {
console.log(e);
const dialogRef = this.dialog.open(e);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
dialogRef == null
});
}
@Component({
selector: 't1',
templateUrl: 't1.html',
})
export class t1 {}
@Component({
selector: 't2',
templateUrl: 't2.html',
})
export class t2 {}
but once I remove the value and fix dialogRef.open
, it works fine
const dialogRef = this.dialog.open(t1);