summaryrefslogtreecommitdiff
path: root/recipeBuddy/src/app/edit-recipe
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-12-12 12:13:46 -0500
committerGitHub <noreply@github.com>2019-12-12 12:13:46 -0500
commit4ec8cbd63deb6cb8b24db58b36ecd4a3ccdda79e (patch)
tree94a26e28d15a6c7cffd7a9671035241073b5c1ee /recipeBuddy/src/app/edit-recipe
parent7d8b3b712274613b20c299efc48e4041e3fc6d72 (diff)
parent4b9b00024ce1b31d4c4c80e35f1298b8317378fc (diff)
Merge pull request #29 from tuckerevans/fixed-edit
Fixed edit ingredients/steps indexing
Diffstat (limited to 'recipeBuddy/src/app/edit-recipe')
-rw-r--r--recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts b/recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts
index e7966b3..22ba048 100644
--- a/recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts
+++ b/recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts
@@ -81,12 +81,12 @@ export class EditRecipeComponent implements OnInit {
for(i = 0; i < r.ingredients.length; i++) {
this.addIngredient();
- this.ingredients.controls[0].setValue(r.ingredients[i]);
+ this.ingredients.controls[i].setValue(r.ingredients[i]);
}
for(i = 0; i < r.steps.length; i++) {
this.addStep();
console.log(r.steps[i])
- this.steps.controls[0].setValue(r.steps[i]);
+ this.steps.controls[i].setValue(r.steps[i]);
}
}
@@ -134,18 +134,18 @@ export class EditRecipeComponent implements OnInit {
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].name,
+ var tmp_amount = parseFloat(formData.ingredients[i].amount)
+ ingredients.push(new Ingredient(formData.ingredients[i].name,
(isNaN(tmp_amount) ? 0 : tmp_amount),
- formData.ingredients[0].unit,
+ formData.ingredients[i].unit,
""
));
}
var steps = []
for (i = 0; i < formData.steps.length; i++) {
- var tmp_timer = parseInt(formData.steps[0].timer)
- steps.push(new Step(formData.steps[0].instruction,
+ var tmp_timer = parseInt(formData.steps[i].timer)
+ steps.push(new Step(formData.steps[i].instruction,
(isNaN(tmp_timer) ? 0 : tmp_timer)
));
}