@@ -11,21 +11,18 @@ <h2 mat-dialog-title>{{ createTitle | translate }}</h2>
1111 autocomplete ="off "
1212 adf-auto-focus
1313 />
14-
15- < mat-hint *ngIf ="libraryTitleExists "> {{
16- 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate
17- }}</ mat-hint >
18- < mat-error *ngIf ="form.controls['title'].hasError('maxlength') ">
19- {{ 'LIBRARY.ERRORS.TITLE_TOO_LONG' | translate }}
20- </ mat-error >
21-
22- < mat-error *ngIf ="form.controls['title'].hasError('minlength') ">
23- {{ 'LIBRARY.ERRORS.TITLE_TOO_SHORT' | translate }}
24- </ mat-error >
25-
26- < mat-error *ngIf ="form.controls['title'].errors?.message ">
27- {{ form.controls['title'].errors?.message | translate }}
28- </ mat-error >
14+ @if (libraryTitleExists) {
15+ < mat-hint > {{ 'LIBRARY.HINTS.SITE_TITLE_EXISTS' | translate }}</ mat-hint >
16+ }
17+ @if (form.controls['title'].errors?.maxlength) {
18+ < mat-error > {{ 'LIBRARY.ERRORS.TITLE_TOO_LONG' | translate }}</ mat-error >
19+ }
20+ @else if (form.controls['title'].errors?.message) {
21+ < mat-error > {{ form.controls['title'].errors?.message | translate }}</ mat-error >
22+ }
23+ @else if (form.controls['title'].errors?.required) {
24+ < mat-error > {{ 'LIBRARY.ERRORS.NAME_REQUIRED' | translate }}</ mat-error >
25+ }
2926 </ mat-form-field >
3027
3128 < mat-form-field class ="adf-library-dialog-form-field ">
@@ -37,13 +34,15 @@ <h2 mat-dialog-title>{{ createTitle | translate }}</h2>
3734 autocomplete ="off "
3835 />
3936
40- < mat-error *ngIf ="form.controls['id'].errors?.message ">
41- {{ form.controls['id'].errors?.message | translate }}
42- </ mat-error >
43-
44- < mat-error *ngIf ="form.controls['id'].hasError('maxlength') ">
45- {{ 'LIBRARY.ERRORS.ID_TOO_LONG' | translate }}
46- </ mat-error >
37+ @if (form.controls['id'].errors?.message) {
38+ < mat-error > {{ form.controls['id'].errors?.message | translate }}</ mat-error >
39+ }
40+ @else if (form.controls['id'].errors?.maxlength) {
41+ < mat-error > {{ 'LIBRARY.ERRORS.ID_TOO_LONG' | translate }}</ mat-error >
42+ }
43+ @else if (form.controls['id'].errors?.required) {
44+ < mat-error > {{ 'LIBRARY.ERRORS.ID_REQUIRED' | translate }}</ mat-error >
45+ }
4746 </ mat-form-field >
4847
4948 < mat-form-field class ="adf-library-dialog-form-field adf-library-dialog-form-field-description ">
@@ -53,10 +52,9 @@ <h2 mat-dialog-title>{{ createTitle | translate }}</h2>
5352 rows ="3 "
5453 formControlName ="description "
5554 > </ textarea >
56-
57- < mat-error *ngIf ="form.controls['description'].hasError('maxlength') ">
58- {{ 'LIBRARY.ERRORS.DESCRIPTION_TOO_LONG' | translate }}
59- </ mat-error >
55+ @if (form.controls['description'].errors?.maxlength) {
56+ < mat-error > {{ 'LIBRARY.ERRORS.DESCRIPTION_TOO_LONG' | translate }}</ mat-error >
57+ }
6058 </ mat-form-field >
6159
6260 < mat-radio-group
@@ -65,17 +63,18 @@ <h2 mat-dialog-title>{{ createTitle | translate }}</h2>
6563 [(ngModel)] ="visibilityOption "
6664 (change) ="visibilityChangeHandler($event) "
6765 >
68- < mat-radio-button
69- color ="primary "
70- class ="adf-library-dialog-radio-group-button "
71- [disabled] ="option.disabled "
72- *ngFor ="let option of visibilityOptions "
73- [attr.data-automation-id] ="option.value "
74- [value] ="option.value "
75- [checked] ="visibilityOption.value === option.value "
76- >
77- {{ option.label | translate }}
78- </ mat-radio-button >
66+ @for (option of visibilityOptions; track option.value) {
67+ < mat-radio-button
68+ color ="primary "
69+ class ="adf-library-dialog-radio-group-button "
70+ [disabled] ="option.disabled "
71+ [attr.data-automation-id] ="option.value "
72+ [value] ="option.value "
73+ [checked] ="visibilityOption === option.value "
74+ >
75+ {{ option.label | translate }}
76+ </ mat-radio-button >
77+ }
7978 </ mat-radio-group >
8079 </ form >
8180</ mat-dialog-content >
0 commit comments