[英]Get User Input from HTML in TypeScript WITHOUT using React or Angular
[英]How to get the value from DB based on the user input using Typescript
我需要根據用戶輸入從數據庫中獲取值。 請在下面找到數據庫的快照。
我的前端有下拉菜單,顯示數據庫中的(名稱),我需要從前端獲取基於類別 I select 的文件夾。 這是我在 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;
});
}
目前,我從下拉列表中獲得名稱 i select 的 ID。 我無法獲取文件夾。 我怎樣才能解決這個問題? 請幫忙!!
已解決.. 只需刪除“+”即可解決此問題:console,log('Selected Category folder is.'; + this.foldername);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.