summaryrefslogtreecommitdiff
path: root/recipeBuddy
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
parent7d8b3b712274613b20c299efc48e4041e3fc6d72 (diff)
parent4b9b00024ce1b31d4c4c80e35f1298b8317378fc (diff)
Merge pull request #29 from tuckerevans/fixed-edit
Fixed edit ingredients/steps indexing
Diffstat (limited to 'recipeBuddy')
-rw-r--r--recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts14
-rw-r--r--recipeBuddy/src/app/recipe-card/recipe-card.component.html2
2 files changed, 8 insertions, 8 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)
));
}
diff --git a/recipeBuddy/src/app/recipe-card/recipe-card.component.html b/recipeBuddy/src/app/recipe-card/recipe-card.component.html
index eaba29a..b6b214b 100644
--- a/recipeBuddy/src/app/recipe-card/recipe-card.component.html
+++ b/recipeBuddy/src/app/recipe-card/recipe-card.component.html
@@ -12,7 +12,7 @@
</mat-card-header>
<mat-card-actions matSuffix>
<div id="edit">
- <button mat-button (click)="edit(recipe)" routerLink="/"
+ <button mat-button (click)="edit(recipe)" routerLink="/edit"
routerLinkActive="active">
<mat-icon>edit</mat-icon>
</button>