From 8135400a9c353a1a91e2226753a81b8095a2b0df Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Thu, 9 Jun 2022 18:42:56 +0200 Subject: [PATCH] change: edit with new element active --- src/app/food/food.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/food/food.component.ts b/src/app/food/food.component.ts index 1a4e0e7..420109f 100644 --- a/src/app/food/food.component.ts +++ b/src/app/food/food.component.ts @@ -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; -- 2.39.5