我正在編寫一個小型的 Angular 應用程序。前端已經構建完畢,一些基本計算是在 Angular 中處理的。我試圖將用戶請求的日期存儲在數據庫中,然后顯示在主管視圖上。我使用 springboot 進行服務,使用 hibernate 生成表和列。任何人都可以為我指明正確的方向,告訴我應該做什么才能繼續我的申請。即使是閱讀材料的鏈接也將不勝感激request.component.html<div> <!-- Header with instructions --> <div> <h2 align="center"> Please Fill out the form to Request days off <br><br> All required fields are marked with an * </h2> </div> <form #testForm="ngForm"> <!-- Start of Page Body --> <div class="card card-w-title"> <!-- Dropdown for user to select supervisor --> <div class="ui-g"> <div class="ui-g-12 ui-md-2"> <p-dropdown [options]="supervisor2" [(ngModel)]="selectedSupervisor2" name="selectedSupervisor2" placeholder="Select a Supervisor*" optionLabel="name" required></p-dropdown> </div> </div> <br><br><br><br><br> <h3 align="center">Requested Dates</h3>
1 回答

白板的微信
TA貢獻1883條經驗 獲得超3個贊
我建議您在 Spring Boot 應用程序中創建一個 POST 控制器,如示例所示。這會將數據保存在數據庫中。
在春季啟動中:
@PostMapping("/users") void?addUser(@RequestBody?User?user)?{ ????userRepository.save(user); }
然后從角度應用程序調用此端點:
this.http.post<User>(this.usersUrl,?user);
類似地,為了在主管屏幕中顯示數據,您可以使用@GetMapping并以角度調用this.http.get。
添加回答
舉報
0/150
提交
取消