import { Component, OnInit, OnDestroy } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { IBar } from 'app/shared/model/bar.model'; @Component({ selector: 'jhi-bar-detail', templateUrl: './bar-detail.component.html' }) export class BarDetailComponent implements OnInit { bar: IBar; constructor(private route: ActivatedRoute) {} ngOnInit() { this.route.data.subscribe(({ bar }) => { this.bar = bar.body ? bar.body : bar; }); } previousState() { window.history.back(); } }