diff options
Diffstat (limited to 'recipeBuddy/src')
-rw-r--r-- | recipeBuddy/src/app/edit-recipe/edit-recipe.component.ts | 14 | ||||
-rw-r--r-- | recipeBuddy/src/app/recipe-card/recipe-card.component.html | 2 |
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> |