I recently created a rest API using flask , now when I tried to use it with my Angular web App , I am receiving these errors ( I Tried to follow the same steps mentioned in the official docs : https://angular.io/tutorial/toh-pt6 )
getBills(): void {
this.BillService.getBills()
.subscribe(bills => this.billData=bills);
}
}
the error is :
ERROR in ../src/app/Bills/add-new-bill.component.ts (61,31): Type '{} | BillModel[]' is not assignable to type 'BillModel[]'. Type '{} | BillModel[]' is not assignable to type 'BillModel[]'. Type '{}' is not assignable to type 'BillModel[]'. Property 'includes' is missing in type '{}'.
this is my bill.service code :
getBills() {
return this.http.get<BillModel[]>('http://localhost:5000/bills/123')
.pipe(
catchError(this.handleError('getBills'))
);
}
and this is the model Class for my bill object :
export class BillModel {
Amount: number;
Bill_id: number;
CreatedAt: string;
From: string;
PaymentDate: string;
PaymentStatus: boolean;
To: string;
};
and it works perfectly but I want to work with the observable mechanism so would u please help or explain to me why I am getting that kind of error