]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
add: remove sub section button
authorBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 16:03:53 +0000 (18:03 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 7 Jun 2022 16:03:53 +0000 (18:03 +0200)
src/app/app.component.html
src/app/app.component.ts

index d06f6db118d1b2c6affefcc873af7f61ec2c034f..a84c46203cbb863d622d1723452162d0879e5267 100644 (file)
        <button class="button"
                type="button"
                (click)="editTitle(title)">Bearbeiten</button>
-       <div *ngFor="let subtitle of title.Subtitles">
+       <div *ngFor="let subtitle of title.Subtitles; let i = index">
                <h2>{{subtitle.Subtitle}}</h2>
                <button class="button"
                        type="button"
                        (click)="editSubtitle(subtitle)">Bearbeiten</button>
+               <button class="button"
+                       type="button"
+                       (click)="removeSubSection(title, i)">Lösche Unterteil</button>
                <div *ngFor="let food of subtitle.Foods; let i = index"
                        class="foodmenu grid">
                        <div class="food">{{food.Food}}</div>
index 674e1069ccef5b9aa2d50eb2e7041aff4ecb7944..ea1ba9a844d1c759ccef211c13e96f90cd783926 100644 (file)
@@ -118,6 +118,11 @@ export class AppComponent
                this.formSubtitleVisible = false;
        }
 
+       public removeSubSection(title: ITitle, index: number)
+       {
+               title.Subtitles.splice(index, 1);
+       }
+
        public saveSubtitle(): void
        {
                this.subtitle = { Subtitle: "", Foods: [] };