File
linkObject
|
linkObject: any
|
Type : any
|
import { Component, OnInit, Input, ChangeDetectionStrategy, HostBinding, ChangeDetectorRef } 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';
interface RelatedLink {
linkObject: any;
title: string;
description: string;
useDescription: boolean;
}
@Component({
selector: 'div[related-links-light-grey-main]',
templateUrl: './related-links-light-grey-main.component.html',
styleUrls: ['./related-links-light-grey-main.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RelatedLinksLightGreyMainComponent implements OnInit {
@Input() entity;
public icon: string;
public title: string;
public linkTargets: RelatedLink[];
public readMoreLinkTitle: string;
public readMoreLinkDestination: string;
@HostBinding('class') get class() { return 'col-md-4 space-between'; }
constructor(
private util: UtilService,
private linkService: ComponentLinkService,
private changeDetector: ChangeDetectorRef ) { }
ngOnInit() {
this.readJSONData();
}
public readJSONData() {
this.icon = this.util.extract(this.entity, 'Icon') || '';
this.title = this.util.extract(this.entity, 'Title') || '';
this.linkTargets = (this.util.extract(this.entity, 'LinkTargets') || []).map(link => this.linkService.parseLink(link));
}
}