import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {BuildInfo} from './build-info'; import {Observable} from 'rxjs'; import {publishReplay, refCount} from 'rxjs/operators'; @Injectable({ providedIn: 'root', }) export class BuildInfoService { private buildInfo: Observable; constructor(private http: HttpClient) { this.buildInfo = this.http.get('./assets/buildinfo.json') .pipe(publishReplay(1), refCount()); } getBuildInfo(): Observable { return this.buildInfo; } }