Trying to fetch data from Database based on user input. Below is a snapshot of the DB for reference.
https://i.sstatic.net/iMRup.png
In my frontend, I have a dropdown that displays names from the database. Upon selection, I need to retrieve the corresponding folder based on the category chosen by the user. Here's what I've attempted in typescript:
loadResourceCategory() {
this.categories = new Array<ResourceCategory>();
this.isLoading = true;
return this.resourceService.getResources()
.then((categories: Array<ResourceCategory>) => {
this.categories = categories;
this.categories.forEach((category: any) => {
category.details = `${category.Name}`;
this.selectedCategory = category.Id;
if (category.Id === this.selectedCategory) {
this.foldername = category.Folder;
console.log('Selected Category folder is :', + this.foldername);
}
});
})
.catch(() => {
this.modalService.error('Resources cannot be loaded now, Please retry later');
})
.finally(() => {
this.isLoading = false;
});
}
Currently, I'm able to retrieve the ID of the selected name but unable to fetch the corresponding Folder information. Any suggestions on how to resolve this issue? Your help is much appreciated!