Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BookForm
<h1>Buchformular</h1>
<form class="ui large form" [formGroup]="bookForm" (ngSubmit)="submitForm()">
<input type="hidden" name="id">
<div class="field">
<label>Buchtitel</label>
<input formControlName="title">
<div *ngIf="errors.title" class="ui negative message"> {{ errors.title }} </div>
</div>
<div class="field">
<label>Untertitel</label>
<input formControlName="subtitle">
</div>
<div class="field" [class.disabled]="isUpdatingBook">
<label>ISBN-Nummer</label>
<input formControlName="isbn">
<div *ngIf="errors.isbn" class="ui negative message">{{ errors.isbn }} </div>
</div>
<div class="field">
<label>Erscheinungsdatum</label>
<input type="date" useValueAsDate formControlName="published">
<div *ngIf="errors.published" class="ui negative message">{{ errors.published }}</div>
</div>
<div class="field">
<label>Beschreibung</label>
<textarea formControlName="description" rows="3"></textarea>
</div>
<div class="field">
<label>Rating</label>
<input type="number" formControlName="rating">
<div *ngIf="errors.rating" class="ui negative message">{{ errors.rating }}</div>
</div>
<div class="field">
<label>Bilder</label>
<div formArrayName="images">
<div class="fields" *ngFor="let control of images?.controls; index as i; last as l" [formGroupName]="i">
<input type="hidden" name="id">
<div class="nine wide field">
<input formControlName="url" placeholder="http://bild{{i+1}}_url">
</div>
<div class="six wide field">
<input formControlName="title" placeholder="Bild{{i+1}}_Titel">
</div>
<div class="one wide field" *ngIf="l">
<button (click)="addThumbnailControl()" class="ui large button" type="button">+</button>
</div>
</div>
</div>
</div>
<button type="submit" class="ui button" [disabled]="bookForm.invalid">Speichern</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.