import { Component, OnInit, Input, OnChanges, SimpleChanges, Output, EventEmitter, AfterViewInit, ElementRef, TemplateRef, ChangeDetectionStrategy, ChangeDetectorRef, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { BreadcrumbService } from '../services/breadcrumb.service'; @Component({ selector: 'cbms-breadcrump', templateUrl: './cbms-breadcrump.component.html', styleUrls: ['./cbms-breadcrump.component.css'], changeDetection: ChangeDetectionStrategy.Eager, standalone: false }) export class CbmsBreadcrumpComponent implements OnInit, OnChanges { @Input('moreInfoText') moreInfoText: any[]; @Input('title') title: any[]; @Input('json') json: any = {}; pageName: any[]; breadcrums: any[]; public breadCrumbs = []; // = [{ label: 'RenewableEnergy&CarbonTracking', data: '/' },]; constructor(public router: Router, public breadcrumbService: BreadcrumbService) { } ngOnChanges(changes: SimpleChanges): void { if(changes['json'].currentValue.length != undefined) this.bindBreadCrump(); } ngOnInit() { } public bindBreadCrump() { // this.breadcrumbService.changeName(JSON.parse(this.json)); this.pageName = JSON.parse(this.json); if (this.pageName) { this.breadcrums = []; this.pageName.forEach(ele => { this.breadcrums.push({ label: ele.text, url: ele.url, Optionalparam: ele.Optionalparam ? ele.Optionalparam[0] : null, isAbsolute: ele.isAbsolute }); }); } } }