Add like in the SPA

Service

Add sendLike to user.service.ts

sendLike(fromUserId: number, toUserId: number) {
  return this.http.post(this.baseUrl + fromUserId + '/like/' + toUserId, {});
}

Component

Open member-card.component.ts implement a new method and add the DI for userService in the constructor

sendLike(toUserId: number) {
  this.userService
    .sendLike(this.authService.getUserId(), toUserId)
    .subscribe(
      _ => this.alertify.success('You like ' + this.user.knownAs + '!'),
      error => this.alertify.error(error)
    );
}

Open member-card.component.html and bind the button click

<li class="list-inline-item">
  <button class="btn btn-primary btn-responsive" (click)="sendLike(user.id)">
    <i class="fa fa-heart"></i>
  </button>
</li>