I want to retrieve a value from my API. The currently returned value is an array of objects.
[
{
"products_id": 793781
},
{
"products_id": 794543
}
]
I would like to use this data to transform it into a number and thus display the number of products_id returned.
I think the method is going to be .length() but I don't know where to put it.
@Input() archiveVente: [];
ngOnInit() {
this.ArchiveVente$ = this.dataMlsService.getProducts('Archive', 'Vente');
console.log(this.ArchiveVente$);
}
getProducts(status, typeTransac):Observable<any> {
// console.log(this.baux);
// for(this.i=0; this.i<9;this.i++ ){
let params = new HttpParams();
params = params.append('status', status);
params = params.append('typeTransac', typeTransac);
return this.apiClient.get(this.ApiUrl, { params: params});
}
<app-compteur [archiveVente]="ArchiveVente$ | async"></app-compteur>
this.ArchiveVente$ = this.dataMlsService.getProducts('Archive', 'Vente').count(product => product.products_id)? xgrommx.github.io/rx-book/content/observable/…