I am trying a simple application where I delete a user after clicking the delete button.
When I try to start such a server, I get an error message thenin the deleteUser()
component:
deleteUser(user: User, event: any) {
event.stopPropagation();
this.userService
.deleteUser(user)
.then(res => {
this.httpUsers = this.httpUsers.filter(h => h !== user);
if (this.selectedUser === user) { this.selectedUser = null; }
})
.catch(error => this.error = error);
}
service:
deleteUser(user: User) {
console.log('Deleting user');
}
Error message:
app / users.component.ts (46,8): error TS2339: the 'then' property does not exist in the 'void' type.
Line 46 from error one above with .then(res => {
While googling, I found this question , so I removed void from the deleteUser function, however, nothing has changed.
Any hint on what I'm doing wrong?
source
share