浏览代码

06-78 Using recipe item

tags/before_ngrx
父节点
当前提交
69d6892225
共有 3 个文件被更改,包括 15 次插入15 次删除
  1. +9
    -4
      src/app/recipes/recipe-list/recipe-item/recipe-item.component.html
  2. +3
    -1
      src/app/recipes/recipe-list/recipe-item/recipe-item.component.ts
  3. +3
    -10
      src/app/recipes/recipe-list/recipe-list.component.html

+ 9
- 4
src/app/recipes/recipe-list/recipe-item/recipe-item.component.html 查看文件

@@ -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>

+ 3
- 1
src/app/recipes/recipe-list/recipe-item/recipe-item.component.ts 查看文件

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { Recipe } from '../../recipe.model';

@Component({
selector: 'app-recipe-item',
@@ -6,6 +7,7 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./recipe-item.component.css']
})
export class RecipeItemComponent implements OnInit {
@Input() recipe: Recipe;

constructor() { }



+ 3
- 10
src/app/recipes/recipe-list/recipe-list.component.html 查看文件

@@ -6,15 +6,8 @@
<hr>
<div class="row">
<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>

正在加载...
取消
保存