base class: since my ts file handling multiple feature's i am splitting them.
constructor(
) {
super(MatDialog);
}
error: Argument of type 'typeof MatDialog' is not assignable to parameter of type 'MatDialog'.
super class:
export class AddClicnicComponent {
popTableSchema;
tableSchema;
@ViewChild('popupTemp', { static: true })
popupTemp: TemplateRef<HTMLAllCollection>;
constructor(public dialog: MatDialog) {
console.log('i am called by super');
}
handleAddClinic() {
this.popTableSchema = { ...this.tableSchema };
this.openDialog(this.popupTemp);
}
openDialog(templateRef: TemplateRef<HTMLAllCollection>) {
const dialogRef = this.dialog.open(templateRef);
dialogRef.afterClosed().subscribe((result) => {
console.log(`Dialog result: ${result}`);
});
}
}
what is the exact params i need to send with super? can't i avoid the params? or what is the right way? needs the help.
CodePudding user response:
you should first add the MatDialog
dependency to the constructor and then pass that instance to the super something like
constructor(public dialog: MatDialog) {
super(dialog); //instance(i.e dialog) is passed here instead of type MatDialog
}
CodePudding user response:
You are sending the class definition to the parent class but you need to send the class istance.