I want to open the components as a dialog via the use case service. The dialog itself contains the use case service to call functions. Unfortunately an Uncaught ReferenceError: Cannot access 'f' before initialization
occurs in the following implementation. Why does the error occur and how can I solve it?
The problem occurs because the dialog is opened in the use case or the dialog then contains the use case. If I call another component, the error does not occur. The error also does not occur if I remove the use case service from the component.
@Injectable()
export class ManageRuleBuilderDialogUsecase {
constructor(
private store: Store,
private dialog: MatDialog,
) {}
public openEmptyRuleBuilderDialog(): void {
this.dialog.open(RuleBuilderDialogComponent, {
width: modalWidth,
height: modalHeight,
});
}
public addAction(): void {
...
}
}
@Component({...})
export class RuleBuilderDialogComponent implements OnInit {
constructor(
private store: Store,
private dialog: MatDialogRef<RuleBuilderDialogComponent>,
private manageRuleBuilderDialogUsecase: ManageRuleBuilderDialogUsecase
) {}
public onAddAction(): void {
this.manageRuleBuilderDialogUsecase.addAction();
}
...
}