diff options
author | Jacob <gatelyjm@clarkson.edu> | 2019-12-10 04:44:33 -0500 |
---|---|---|
committer | Jacob <gatelyjm@clarkson.edu> | 2019-12-10 04:44:33 -0500 |
commit | 7698331e4bb85232535182eeeaa09fdf54b66a76 (patch) | |
tree | 96d6f523a7d428d6b407cf622d322655bfc066ec /recipeBuddy/src/app/recipe-card/recipe-card.component.ts | |
parent | 1b23ba09800009f484b9ab6a49a5626b0baaf504 (diff) |
Update main page to put recipes three wide, and to work
Diffstat (limited to 'recipeBuddy/src/app/recipe-card/recipe-card.component.ts')
-rw-r--r-- | recipeBuddy/src/app/recipe-card/recipe-card.component.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/recipeBuddy/src/app/recipe-card/recipe-card.component.ts b/recipeBuddy/src/app/recipe-card/recipe-card.component.ts index bd44316..a9a4618 100644 --- a/recipeBuddy/src/app/recipe-card/recipe-card.component.ts +++ b/recipeBuddy/src/app/recipe-card/recipe-card.component.ts @@ -1,5 +1,6 @@ import {Component,OnInit} from '@angular/core'; import{BackendService} from '../REST_service/backend.service'; +import{Recipe} from '../DataModels/recipe'; /** * @title Card with multiple sections @@ -13,8 +14,8 @@ export class RecipeCardComponent implements OnInit { constructor(private restService: BackendService) {} - recipes = []; //array of recipe objects - mynumbers = []; + + recipes: Recipe[] = []; //array of recipe objects ngOnInit() { this.restService.getRecipes().subscribe( @@ -23,8 +24,10 @@ export class RecipeCardComponent implements OnInit { for(i = 0; i < res.length; i++) { this.restService.getRecipe(res[i]).subscribe( res2 => { - this.recipes.push(res2) + this.recipes = [...this.recipes, res2] + console.log(res2.photos) }, err => {/*Deal with error*/}, () => {/*Code for complete observable*/} + ); } }, @@ -35,10 +38,6 @@ export class RecipeCardComponent implements OnInit { //Complete observable } ); - for(var i = 0; i <10; ++i) - { - mynumbers.push(i); - } } shoppingCart() { |