type="button"
id="buttonTitle"
(click)="changeFormTitleVisible()">Titel hinzufügen</button>
-<button class="button main"
- type="button"
- id="buttonFood"
- [disabled]="disableFoodButton()"
- (click)="changeFormFoodVisible()">Speise hinzufügen</button>
<form #formTitle="ngForm" *ngIf="formTitleVisible" class="form">
<label>Titel</label>
<input [(ngModel)]="food.sideDish" name="sideDish" type="text" />
<label>Preis</label>
<input [(ngModel)]="food.price" name="price" type="text" />
- <button class="button"
- type="button"
- id="addFood"
- [disabled]="edit || disableByInsertMode()"
- (click)="addFood()">Hinzufügen</button>
<button class="button"
type="button"
id="insertFood"
<button class="button"
type="button"
(click)="removeSubSection(title, i)">Lösche Unterteil</button>
+ <button class="button"
+ type="button"
+ id="buttonFood"
+ [disabled]="disableFoodButton()"
+ (click)="addNewFood(title, i)">Speise hinzufügen</button>
<div *ngFor="let food of subtitle.Foods; let i = index"
class="foodmenu grid">
<div class="food">{{food.Food}}</div>
this.formSubtitleVisible = !this.formSubtitleVisible;
}
- public changeFormFoodVisible(): void
+ public addNewFood(title: ITitle, index: number): void
{
+ let titleIndex = this.foodcard.Titles.indexOf(title);
+ this.insertIndicies = [ titleIndex, index,
+ title.Subtitles[index].Foods.length - 1 ];
this.formFoodVisible = !this.formFoodVisible;
}