| @@ -1,4 +1,9 @@ | |||||
| <p> | |||||
| recipe-item works! | |||||
| </p> | |||||
| <a href="#" class="list-group-item clearfix"> | |||||
| <div class="pull-left"> | |||||
| <h4 class="list-group-item-heading">{{ recipe.name }}</h4> | |||||
| <p class="list-group-item-text">{{ recipe.description }}</p> | |||||
| </div> | |||||
| <span class="pull-right"> | |||||
| <img [src]="recipe.imagePath" alt="{{ recipe.name }}" class="img-responsive" style="max-height: 50px;"> | |||||
| </span> | |||||
| </a> | |||||
| @@ -1,4 +1,5 @@ | |||||
| import { Component, OnInit } from '@angular/core'; | |||||
| import { Component, OnInit, Input } from '@angular/core'; | |||||
| import { Recipe } from '../../recipe.model'; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-recipe-item', | selector: 'app-recipe-item', | ||||
| @@ -6,6 +7,7 @@ import { Component, OnInit } from '@angular/core'; | |||||
| styleUrls: ['./recipe-item.component.css'] | styleUrls: ['./recipe-item.component.css'] | ||||
| }) | }) | ||||
| export class RecipeItemComponent implements OnInit { | export class RecipeItemComponent implements OnInit { | ||||
| @Input() recipe: Recipe; | |||||
| constructor() { } | constructor() { } | ||||
| @@ -6,15 +6,8 @@ | |||||
| <hr> | <hr> | ||||
| <div class="row"> | <div class="row"> | ||||
| <div class="col-xs-12"> | <div class="col-xs-12"> | ||||
| <a href="#" class="list-group-item clearfix" *ngFor="let recipe of recipes"> | |||||
| <div class="pull-left"> | |||||
| <h4 class="list-group-item-heading">{{ recipe.name }}</h4> | |||||
| <p class="list-group-item-text">{{ recipe.description }}</p> | |||||
| </div> | |||||
| <span class="pull-right"> | |||||
| <img [src]="recipe.imagePath" alt="{{ recipe.name }}" class="img-responsive" style="max-height: 50px;"> | |||||
| </span> | |||||
| </a> | |||||
| <app-recipe-item></app-recipe-item> | |||||
| <app-recipe-item | |||||
| *ngFor="let recipeElement of recipes" | |||||
| [recipe]="recipeElement"></app-recipe-item> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||