]> gitweb.hhaalo.de Git - speisekarten-editor.git/commitdiff
change: edit with new element active
authorBastian Dehn <hhaalo@arcor.de>
Thu, 9 Jun 2022 16:42:56 +0000 (18:42 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Thu, 9 Jun 2022 16:42:56 +0000 (18:42 +0200)
src/app/food/food.component.ts

index 1a4e0e705493c9850bbb164525f258ffa065b1e2..420109fb8647668ba95dc4d5dd2988cbadab31b5 100644 (file)
@@ -1,4 +1,4 @@
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
 import { IFood } from '../ifood';
 
 @Component({
@@ -6,13 +6,21 @@ import { IFood } from '../ifood';
        templateUrl: './food.component.html',
        styleUrls: ['./food.component.css']
 })
-export class FoodComponent
+export class FoodComponent implements OnInit
 {
        @Input() food: IFood = { Food: "", sideDish: "", price: "" };
        public formFoodVisible: boolean = false;
 
        constructor() {}
 
+       public ngOnInit(): void
+       {
+               if (this.food.Food === ""
+                       && this.food.sideDish === ""
+                       && this.food.price === "" )
+                       this.formFoodVisible = true;
+       }
+
        public editFood(): void
        {
                this.formFoodVisible = true;