import { Component, OnInit } from '@angular/core'; import {FullnodeService} from '../fullnode.service'; import {Subscription} from 'rxjs'; @Component({ selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.css'] }) export class HeaderComponent implements OnInit { height = 0; private FullnodeSub: Subscription = new Subscription(); constructor(public fullnodeService: FullnodeService){ } ngOnInit(){ this.fullnodeService.getHeight(); this.FullnodeSub=this.fullnodeService.getHeightUpdateListener(). subscribe((height: number) => { this.height = height; }); } }