From 83c2fdd4dd552ac0dbbefba2480df7907285df4b Mon Sep 17 00:00:00 2001 From: piratefinn Date: Mon, 15 Jan 2018 15:33:38 +0000 Subject: [PATCH] Retrieving categories from API --- src/app/dashboard/add-data.component.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/dashboard/add-data.component.ts b/src/app/dashboard/add-data.component.ts index ffa4ef8..7ca6cd1 100644 --- a/src/app/dashboard/add-data.component.ts +++ b/src/app/dashboard/add-data.component.ts @@ -37,6 +37,8 @@ export class AddDataComponent implements OnInit { transactionFormInvalid = true; myDate: any; minDate: any; + categoryIds: number[] = []; + categoryNames: string[] = []; constructor( private formBuilder: FormBuilder, @@ -64,6 +66,16 @@ export class AddDataComponent implements OnInit { }); this.myDate = moment().format('YYYY-MM-DD[T]HH:mm'); // this.myDate = new Date().toISOString().slice(0, 16); + this.api.categoryList().subscribe( + result => { + this.categories = result; + console.log(this.categories); + }, + error => { + console.log('Retrieval Error'); + console.log( error._body ); + } + ); } ngOnInit(): void {