<input [(ngModel)]="subtitle" name="subtitle" type="text" />
<button class="button"
type="button"
- id="addSubtitle">Hinzufügen</button>
+ id="addSubtitle"
+ (click)="addSubtitle()">Hinzufügen</button>
</form>
<form #formFood="ngForm" *ngIf="formFoodVisible" class="form">
<div *ngFor="let title of foodcard.Titles">
<h1>{{title.Title}}</h1>
+ <div *ngFor="let subtitle of title.Subtitles">
+ <h2>{{subtitle.Subtitle}}</h2>
+ </div>
</div>
});
this.formTitleVisible = false;
}
+
+ public addSubtitle(): void
+ {
+ let lastIndex = this.foodcard.Titles.length - 1;
+ this.foodcard.Titles[lastIndex].Subtitles.push({
+ Subtitle: this.subtitle,
+ Foods: []
+ });
+ this.formSubtitleVisible = false;
+ }
}