so recently I updated my project to version 15 of Angular. I followed the guide from the official Angular documents, however, ever since I removed my entryComponents, my MatDialog does not open correctly. I have since also transformed every component I had to standalone. Everything up to the Dialog components works.
In my console I only get the error "Cannot read properties of undefined (reading 'errorState')". However, even removing and creating a fully new MatDialog component does not seem to remove this error. Does anyone know how I can fix this? I really do not know from where this could come from :?
TS Button to open Dialog:
openAddPhonenumberDialog() {
const dialogRef = this.dialog.open(AddPhonenumberComponent, {
minWidth: "300px",
autoFocus: false,
});
}
TS PhonenumberComponnet
Component({
selector: "app-add-phonenumber",
templateUrl: "./add-phonenumber.component.html",
styleUrls: ["./add-phonenumber.component.css"],
standalone: true,
imports: [
MatDialogModule,
FormsModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatSelectModule,
MatOptionModule,
NgIf,
MatButtonModule,
],
})
HTML PhonenumberComponent
<h2 mat-dialog-title>Add a new phonenumber</h2>
<form [formGroup]="addPhonenumberForm" (ngSubmit)="onAddNewPhonenumber()">
<mat-dialog-content style="display:flex;flex-direction: column;">
<mat-form-field>
<mat-label>Phonenumber</mat-label>
<input matInput formControlName="phonenumber" type="tel" required
(input)="formatInput()">
</mat-form-field>
</mat-dialog-content>
<mat-dialog-actions>
<button mat-button [mat-dialog-close] (click)="close()">Close</button>
<button type="submit" mat-button [mat-dialog-close]="result" >Save</button>
</mat-dialog-actions>
</form>
My package.json:
"@angular-devkit/core": "^16.1.8",
"@angular-devkit/schematics": "^16.1.8",
"@angular/animations": "~15.2.9",
"@angular/cdk": "^15.2.9",
"@angular/common": "~15.2.9",
"@angular/compiler": "~15.2.9",
"@angular/core": "~15.2.9",
"@angular/forms": "~15.2.9",
"@angular/material": "^15.2.9",
"@angular/platform-browser": "^15.2.9",
"@angular/platform-browser-dynamic": "~15.2.9",
"@angular/router": "~15.2.9",
"@types/gapi.client.drive": "^3.0.8",
"angular-in-memory-web-api": "^0.9.0",
"bootstrap": "^4.4.1",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"jquery": "^3.6.0",
"moment": "^2.26.0",
"popper.js": "^1.16.0",
"rxjs": "^6.5.5",
"tslib": "^2.0.0",
"xstate": "~4.6.7",
"zone.js": "~0.11.8"
},
Picture of how it looks like right now: