summaryrefslogtreecommitdiff
path: root/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts')
-rw-r--r--recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts62
1 files changed, 62 insertions, 0 deletions
diff --git a/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
new file mode 100644
index 0000000..26808ee
--- /dev/null
+++ b/recipeBuddy/src/app/shopping-cart/shopping-cart.component.ts
@@ -0,0 +1,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 {
+
+ }
+}