1 import { Component, OnInit } from '@angular/core';
3 import { NotificationsService } from 'angular2-notifications';
5 import { Friend, FriendService } from '../shared';
8 selector: 'my-friend-list',
9 templateUrl: './friend-list.component.html',
10 styleUrls: [ './friend-list.component.scss' ]
12 export class FriendListComponent implements OnInit {
16 private notificationsService: NotificationsService,
17 private friendService: FriendService
25 if (!confirm('Are you sure?')) return;
27 this.friendService.quitFriends().subscribe(
29 this.notificationsService.success('Sucess', 'Friends left!');
34 err => this.notificationsService.error('Error', err.text)
38 private getFriends() {
39 this.friendService.getFriends().subscribe(
40 res => this.friends = res.friends,
42 err => this.notificationsService.error('Error', err.text)