Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
Angular service in MatDialog leads to Uncaught ReferenceError

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();
  }
  ...
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda