Retrieving categories from API

This commit is contained in:
piratefinn 2018-01-15 15:33:38 +00:00
parent e64b6057e8
commit 59efe7a650

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 {