]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
add: title button add method
authorBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 11:07:19 +0000 (13:07 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 6 Jun 2022 11:07:19 +0000 (13:07 +0200)
src/app/app.component.html
src/app/app.component.ts

index d556a0cf89f39a193af532c18f1d910698378dd6..147432fd3c45825a76a52cfff07a7c53303350b0 100644 (file)
@@ -16,7 +16,8 @@
        <input [(ngModel)]="title" name="title" type="text" />
        <button class="button"
                type="button"
-               id="addTitle">Hinzufügen</button>
+               id="addTitle"
+               (click)="addTitle()">Hinzufügen</button>
 </form>
 
 <form #formSubtitle="ngForm" *ngIf="formSubtitleVisible" class="form">
@@ -38,3 +39,7 @@
                type="button"
                id="addFood">Hinzufügen</button>
 </form>
+
+<div *ngFor="let title of foodcard.Titles">
+       <h1>{{title.Title}}</h1>
+</div>
index 49ca5aceaacc6a53bfd5261d9a259641b15a2399..b56a235219ac79d9c23cb1ae1fadecfa2f817c36 100644 (file)
@@ -38,4 +38,12 @@ export class AppComponent
        {
                this.formFoodVisible = !this.formFoodVisible;
        }
+
+       public addTitle(): void
+       {
+               this.foodcard.Titles.push({
+                       Title: this.title,
+                       Subtitles: []
+               });
+       }
 }