1 import { Component, OnInit } from '@angular/core';
3 import { Friend, FriendService } from '../shared';
6 selector: 'my-friend-list',
7 templateUrl: './friend-list.component.html',
8 styleUrls: [ './friend-list.component.scss' ]
10 export class FriendListComponent implements OnInit {
13 constructor(private friendService: FriendService) { }
20 if (!confirm('Are you sure?')) return;
22 this.friendService.quitFriends().subscribe(
24 alert('Quit friends!');
27 error => alert(error.text)
31 private getFriends() {
32 this.friendService.getFriends().subscribe(
33 friends => this.friends = friends,
35 err => alert(err.text)