diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-11 16:42:15 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-11 16:42:15 -0500 |
commit | 643e4262e8cdd63b546ea7f9b3c8e85883e0215c (patch) | |
tree | f0fcc15c8714939ce7f84963e68373d31c442873 /recipeBuddy/src | |
parent | 77f57229c02521f00be16fe27e8e672f06809dbc (diff) |
Fix adding ingredients
Ingredients form array is now indexed based on for loop, not just set to 0.
Diffstat (limited to 'recipeBuddy/src')
-rw-r--r-- | recipeBuddy/src/app/add-recipe/add-recipe.component.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts index 5109c34..0366950 100644 --- a/recipeBuddy/src/app/add-recipe/add-recipe.component.ts +++ b/recipeBuddy/src/app/add-recipe/add-recipe.component.ts @@ -93,10 +93,10 @@ export class AddRecipeComponent { var ingredients = [] var i; for (i = 0; i < formData.ingredients.length; i++) { - var tmp_amount = parseFloat(formData.ingredients[0].amount) - ingredients.push(new Ingredient(formData.ingredients[0].ingrName, + var tmp_amount = parseFloat(formData.ingredients[i].amount) + ingredients.push(new Ingredient(formData.ingredients[i].ingrName, (isNaN(tmp_amount) ? 0 : tmp_amount), - formData.ingredients[0].unit, + formData.ingredients[i].unit, "" )); } |