ERROR NullInjectorError: R3InjectorError(Standalone[_KeyEntryDialogComponent])[OverlayRef -> OverlayRef -> OverlayRef -> OverlayRef]:
NullInjectorError: No provider for OverlayRef!
I get this error when trying to open the following dialog, like so. However, it seems that in this component, it doesn't want to open any dialogs by the look of it. The full component is attached.
this.dialogService.open(KeyEntryDialogComponent, {
data: Object.keys(this.form.controls),
}).afterClosed().pipe(first()).subscribe((result: string | null) => {
if (result) {
const control = new FormControl('',
[
Validators.required,
validType,
],
);
this.form.addControl(result, control);
}
});
<mat-dialog-container>
<mat-dialog-content>
<mat-form-field appearance="outline">
<mat-label>Attribute Name</mat-label>
<input matInput [formControl]="value">
@if (value.invalid) {
{{ error() }}
}
</mat-form-field>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-button [mat-dialog-close]="null">Cancel</button>
<button mat-button [mat-dialog-close]="value.value" [disabled]="value.invalid">
Create
</button>
</mat-dialog-actions>
</mat-dialog-container>