File
linkTargets
|
linkTargets: ComponentLink[]
|
Type : ComponentLink[]
|
import { Component, OnInit, Input, ChangeDetectionStrategy, HostBinding } from '@angular/core';
import { UtilService } from 'src/app/core/services/util-service/util.service';
import { ComponentLinkService } from 'src/app/core/services/component-link-service/component-link.service';
import { IdGeneratorService } from 'src/app/core/services/id-generator.service';
import { ComponentLink } from 'src/app/core/interfaces/interfaces.component';
interface IRelatedLinks {
icon: string;
title: string;
linkTargets: ComponentLink[];
id: string;
}
@Component({
selector: 'div[related-links-footer]',
templateUrl: './related-links-footer.component.html',
styleUrls: ['./related-links-footer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RelatedLinksFooterComponent implements OnInit {
@Input() entity;
data: IRelatedLinks;
@HostBinding('class') get class() { return 'col-md-4'; }
constructor(
private util: UtilService,
private linkService: ComponentLinkService,
private idService: IdGeneratorService
) { }
ngOnInit() {
if (this.entity) {
this.data = this.parseJson(this.entity);
}
}
parseJson(data: any): IRelatedLinks {
return {
icon: this.util.extract(data, 'Icon'),
title: this.util.extract(data, 'Title'),
linkTargets: this.util.extract(data, 'LinkTargets').map(link => this.linkService.parseLink(link)),
id: this.idService.getId()
};
}
}