Skip to content

Commit

Permalink
fix(public forms): show loading until form is ready to avoid errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Jul 2, 2024
1 parent ed5ad89 commit 96c3712
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions src/app/features/public-form/public-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@
<mat-card-title>{{ formConfig?.title }}</mat-card-title>
<mat-card-subtitle>{{ formConfig?.description }}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<app-entity-form
[entity]="entity"
[fieldGroups]="fieldGroups"
[form]="form"
[gridLayout]="false"
></app-entity-form>
</mat-card-content>
<mat-card-footer>
<button
mat-raised-button
(click)="submit()"
color="accent"
i18n="Submit form button"
>
Submit Form
</button>
<button mat-stroked-button (click)="reset()" i18n="Reset form button">
Reset
</button>
</mat-card-footer>

@if (formConfig && form) {
<mat-card-content>
<app-entity-form
[entity]="entity"
[fieldGroups]="fieldGroups"
[form]="form"
[gridLayout]="false"
></app-entity-form>
</mat-card-content>

<mat-card-footer>
<button
mat-raised-button
(click)="submit()"
color="accent"
i18n="Submit form button"
>
Submit Form
</button>
<button mat-stroked-button (click)="reset()" i18n="Reset form button">
Reset
</button>
</mat-card-footer>
} @else {
<mat-card-content>
<p i18n>Loading form ...</p>
</mat-card-content>
}
</mat-card>

0 comments on commit 96c3712

Please sign in to comment.