Retrieving categories from API

This commit is contained in:
piratefinn 2018-01-15 15:33:38 +00:00
parent 3da4c4164d
commit 83c2fdd4dd

View file

@ -37,6 +37,8 @@ export class AddDataComponent implements OnInit {
transactionFormInvalid = true; transactionFormInvalid = true;
myDate: any; myDate: any;
minDate: any; minDate: any;
categoryIds: number[] = [];
categoryNames: string[] = [];
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
@ -64,6 +66,16 @@ export class AddDataComponent implements OnInit {
}); });
this.myDate = moment().format('YYYY-MM-DD[T]HH:mm'); this.myDate = moment().format('YYYY-MM-DD[T]HH:mm');
// this.myDate = new Date().toISOString().slice(0, 16); // 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 { ngOnInit(): void {