Fix bindings
continuous-integration/drone/push Build is passing Details

main
Clément FRÉVILLE 6 days ago
parent 571df652d6
commit ad3e268550

@ -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;
}; };

Loading…
Cancel
Save