Fix bindings
This commit is contained in:
@@ -48,5 +48,6 @@ export class IngredientsComponent {
|
|||||||
|
|
||||||
delete(ingredient: Ingredient): void {
|
delete(ingredient: Ingredient): void {
|
||||||
this.recipes.deleteIngredient(ingredient);
|
this.recipes.deleteIngredient(ingredient);
|
||||||
|
this.dataSource.data = this.recipes.getAllIngredients();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -54,6 +54,7 @@ export class RecipeAddComponent {
|
|||||||
name: recipe.name,
|
name: recipe.name,
|
||||||
description: recipe.description,
|
description: recipe.description,
|
||||||
});
|
});
|
||||||
|
this.ingredientEntries = recipe.ingredients;
|
||||||
}
|
}
|
||||||
get recipeId() {
|
get recipeId() {
|
||||||
return this.#recipeId;
|
return this.#recipeId;
|
||||||
@@ -84,7 +85,6 @@ export class RecipeAddComponent {
|
|||||||
|
|
||||||
onAddIngredient(): void {
|
onAddIngredient(): void {
|
||||||
const value = this.createForm.value;
|
const value = this.createForm.value;
|
||||||
console.log(value);
|
|
||||||
|
|
||||||
if (!value.selectedIngredient) {
|
if (!value.selectedIngredient) {
|
||||||
return;
|
return;
|
||||||
@@ -95,7 +95,6 @@ export class RecipeAddComponent {
|
|||||||
}
|
}
|
||||||
this.ingredientEntries.push({
|
this.ingredientEntries.push({
|
||||||
idIngredient: id,
|
idIngredient: id,
|
||||||
idRecipe: -1,
|
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,8 @@ export class RecipeService {
|
|||||||
description: 'La meilleure recette de pâte à crêpes',
|
description: 'La meilleure recette de pâte à crêpes',
|
||||||
image: '',
|
image: '',
|
||||||
ingredients: [
|
ingredients: [
|
||||||
{ idIngredient: 1, idRecipe: 0, quantity: 10 },
|
{ idIngredient: 1, quantity: 10 },
|
||||||
{ idIngredient: 2, idRecipe: 0, quantity: 15 },
|
{ idIngredient: 2, quantity: 15 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ id: 1, name: 'crepe2', description: 'La meilleure recette de pâte à crêpes', image: '', ingredients: [] },
|
{ id: 1, name: 'crepe2', description: 'La meilleure recette de pâte à crêpes', image: '', ingredients: [] },
|
||||||
|
@@ -13,7 +13,6 @@ export type Recipe = {
|
|||||||
|
|
||||||
export type IngredientEntry = {
|
export type IngredientEntry = {
|
||||||
idIngredient: number;
|
idIngredient: number;
|
||||||
idRecipe: number;
|
|
||||||
quantity: number;
|
quantity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user