switch to one-way-binding in form

This commit is contained in:
2021-11-01 21:17:20 +01:00
parent 125af5a206
commit 0ab106d021
2 changed files with 11 additions and 7 deletions

View File

@ -1,24 +1,24 @@
<div id="firstBlock">
<form (ngSubmit)="addAccountEntry()">
<form (ngSubmit)="addAccountEntry(userForm)" #userForm="ngForm">
<mat-form-field appearance="outline" id="addEntryfield">
<mat-label>Datum</mat-label>
<input matInput name="createdAt" [(ngModel)]="newAccountEntry.created_at" [matDatepicker]="createdAtPicker"/>
<input matInput ngModel name="createdAt" [matDatepicker]="createdAtPicker"/>
<mat-datepicker-toggle matSuffix [for]="createdAtPicker"></mat-datepicker-toggle>
<mat-datepicker #createdAtPicker></mat-datepicker>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Kategorie</mat-label>
<mat-select [(ngModel)]="newAccountEntry.account_entry_category" name="category" [disabled]="shallBeRentPayment">
<mat-select ngModel name="category" [disabled]="shallBeRentPayment">
<mat-option *ngFor="let p of accountEntryCategories" [value]="p.id">{{p.description}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Betrag (€)</mat-label>
<input matInput type="number" name="amount" [(ngModel)]="newAccountEntry.amount"/>
<input matInput type="number" name="amount" ngModel/>
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Beschreibung</mat-label>
<input matInput name="description" [(ngModel)]="newAccountEntry.description"/>
<input matInput name="description" ngModel/>
</mat-form-field>
<button #addAccountEntryButton type="submit" mat-raised-button color="primary">Buchung speichern</button>
</form>