Browse Source

03-52 Added the ingredients

tags/before_ngrx
Nils Dittberner 8 years ago
parent
commit
043d95d3bb
3 changed files with 17 additions and 1 deletions
  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 View File

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

+ 9
- 1
src/app/shopping-list/shopping-list.component.html View File

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

@@ -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() { }



Loading…
Cancel
Save