1 import { Component, OnInit } from '@angular/core';
2 import { ROUTER_DIRECTIVES } from '@angular/router';
4 import { Friend, FriendService } from '../shared';
7 selector: 'my-friend-list',
8 template: require('./friend-list.component.html'),
9 styles: [ require('./friend-list.component.scss') ],
10 directives: [ ROUTER_DIRECTIVES ]
12 export class FriendListComponent implements OnInit {
15 constructor(private friendService: FriendService) { }
22 if (!confirm('Are you sure?')) return;
24 this.friendService.quitFriends().subscribe(
26 alert('Quit friends!');
33 private getFriends() {
34 this.friendService.getFriends().subscribe(
35 friends => this.friends = friends,