소스 검색

03-52 Added the ingredients

tags/before_ngrx
Nils Dittberner 8 년 전
부모
커밋
043d95d3bb
3개의 변경된 파일17개의 추가작업 그리고 1개의 파일을 삭제
  1. +3
    -0
      src/app/shared/ingredient.model.ts
  2. +9
    -1
      src/app/shopping-list/shopping-list.component.html
  3. +5
    -0
      src/app/shopping-list/shopping-list.component.ts

+ 3
- 0
src/app/shared/ingredient.model.ts 파일 보기

@@ -0,0 +1,3 @@
export class Ingredient {
constructor(public name: string, public amount: number) {}
}

+ 9
- 1
src/app/shopping-list/shopping-list.component.html 파일 보기

@@ -2,6 +2,14 @@
<div class="col-xs-10">
<app-shopping-edit></app-shopping-edit>
<hr>
<p>The list</p>
<ul class="list-group">
<a
class="list-group-item"
style="cursor: pointer;"
*ngFor="let ingredient of ingredients"
>
{{ ingredient.name }} ({{ ingredient.amount }})
</a>
</ul>
</div>
</div>

+ 5
- 0
src/app/shopping-list/shopping-list.component.ts 파일 보기

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Ingredient } from '../shared/ingredient.model';

@Component({
selector: 'app-shopping-list',
@@ -6,6 +7,10 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./shopping-list.component.css']
})
export class ShoppingListComponent implements OnInit {
ingredients: Ingredient[] = [
new Ingredient('Apples', 5),
new Ingredient('Tomatos', 10)
];

constructor() { }



불러오는 중...
취소
저장