I am currently utilizing Angular7 in conjunction with the Loopback API to manage data. I am seeking assistance on how to implement a delete functionality within tables. Could you please offer some guidance?
Despite my attempts, the code I have implemented so far does not seem to be functioning properly. Below is the snippet of code I have used:
file.component.html
<td><button class="btn btn-success" (click)="deleteUser(user)"> Delete</button></td>
file.component.ts
deleteUser(user: User): void {
this.apiService.deleteUser(user.id);
};
api.service.ts
deleteUser(id: number): Observable<ApiResponse> {
return this.http.delete<ApiResponse>(this.baseUrl + id);
}
Additionally, could you provide me with the codes for other operations such as update and create as well?