File

app/dxa/dxa-entity/views/related-link-views/related-links-footer/related-links-footer.component.ts

Index

Properties

Properties

icon
icon: string
Type : string
id
id: string
Type : string
linkTargets
linkTargets: ComponentLink[]
Type : ComponentLink[]
title
title: string
Type : string
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()
		};
	}
}

result-matching ""

    No results matching ""