import { Component , OnInit } from '@angular/core' ; import { User } from '../../models/user' ; import { UserService } from '../../services/user.service' ; import { Router } from '@angular/router' ; @ Component ( { selector : '.userBox' , styleUrls : [ './user-box.component.css' ] , templateUrl : './user-box.component.html' } ) export class UserBoxComponent implements OnInit { public currentUser : User = new User ( { avatarUrl : 'assets/img/user2-160x160.jpg' , email : 'weber.antoine@outlook.com' , firstname : 'WEBER' , lastname : 'Antoine' } ) ; constructor ( private userServ , private router ) { this . userServ . getCurrent ( ) . subscribe ( ( user ) => this . currentUser = user ) ; } public ngOnInit ( ) { } public logout = ( ) : void => { this . userServ . logout ( ) ; } ; }