import { Component, OnInit } from '@angular/core'; import { AccountService } from '../login/account.service'; @Component({ selector: 'app-toolbar', templateUrl: './toolbar.component.html', styleUrls: ['./toolbar.component.scss'] }) export class ToolbarComponent implements OnInit { public username: string constructor(public account: AccountService) { account.subscribe((username: string) => { this.username = username }) this.username = account.username } ngOnInit(): void { } }