Hi
I have the below code.
this code will go to my api and get all values in the table and put them in an array photos then assign it to allphotos. when looking what it got, it is getting all fields but the unique id key. How to get that as it is needed to delete photos.
ngOnInit() {
const httpOptions = {
headers: new HttpHeaders({
Authorization: 'Bearer ' + localStorage.getItem('token')
})};
const photos:any[] = [];
this.http.get<{[key:string]: any}>(this.baseUrl + '/familydocuments/list/', httpOptions)
.pipe(map((res) => {
for(const key in res)
{
if(res.hasOwnProperty(key))
{
photos.push({...res[key], id: key})
}
}
return photos;
}))
.subscribe((photos) =>{
console.log(photos);
this.allPhotos = photos;
});
this.initializeFileUploader();
}