blob: 26808ee5d250d19b27de01e126306751be7ab272 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
import { Component, OnInit } from '@angular/core';
import { MatSelectModule } from '@angular/material/select';
import { MatDividerModule } from '@angular/material/divider';
import { BackendService } from '../REST_service/backend.service';
import { FormsModule } from '@angular/forms';
import { Recipe } from '../DataModels/recipe';
import { Ingredient } from '../DataModels/ingredient';
@Component({
selector: 'shopping-cart.component',
templateUrl: './shopping-cart.component.html',
styleUrls: ['./shopping-cart.component.css']
})
export class ShoppingCartComponent implements OnInit {
recipes: Recipe[] = [];
ingredients : Ingredient[] = [];
units: string[] = [];
amounts: number[] = [];
types: string[] = [];
rIDs: number[] = [];
constructor( private restService: BackendService) {
this.restService.getRecipes().subscribe(
res => {
var i: number;
for(i = 0; i < res.length; i++) {
this.restService.getRecipe(res[i]).subscribe(
res2 => {
this.recipes.push(res2)
});
}
});
}
ngOnInit() {
}
addAll(): void {
}
addRecipe(id: number): void {
}
addIngredient(ing: Ingredient): void {
this.ingredients.push(ing);
}
printList(): void {
}
}
|