1
|
import {Component, Input} from '@angular/core';
|
2
|
import {ActivatedRoute} from '@angular/router';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'showTitle',
|
6
|
template: `
|
7
|
<h1 *ngIf="isH1" [ngClass]="classNames">
|
8
|
<ng-container *ngTemplateOutlet="_title;"></ng-container>
|
9
|
</h1>
|
10
|
<h2 *ngIf="!isH1" [ngClass]="classNames">
|
11
|
<ng-container *ngTemplateOutlet="_title;"></ng-container>
|
12
|
</h2>
|
13
|
<ng-template #_title>
|
14
|
<div *ngIf="title != undefined" class="landingTitle">
|
15
|
<span *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
|
16
|
class="custom-external">
|
17
|
<a *ngIf="title['name'] != undefined && title['name'] != ''"
|
18
|
href="{{title['url']}}" target="_blank"
|
19
|
[innerHTML]="title['name']">
|
20
|
</a>
|
21
|
<a *ngIf="title['name'] == undefined || title['name'] == ''"
|
22
|
href="{{title['url']}}" target="_blank">
|
23
|
[no title available]
|
24
|
</a>
|
25
|
</span>
|
26
|
<span *ngIf="(title['name'] != undefined && title['name'] != '') &&
|
27
|
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
28
|
[innerHTML]="title['name']">
|
29
|
</span>
|
30
|
<span *ngIf="(title['name'] == undefined || title['name'] == '') &&
|
31
|
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
32
|
>
|
33
|
[no title available]
|
34
|
</span>
|
35
|
</div>
|
36
|
<div *ngIf="titleName">
|
37
|
<span [innerHTML]="titleName"></span>
|
38
|
</div>
|
39
|
<div *ngIf="!titleName && !title">
|
40
|
<span>No title available</span>
|
41
|
</div>
|
42
|
</ng-template>
|
43
|
`
|
44
|
|
45
|
})
|
46
|
|
47
|
export class ShowTitleComponent {
|
48
|
@Input() titleName: string;
|
49
|
@Input() title: { [key: string]: string };
|
50
|
@Input() iconClass:string;
|
51
|
@Input() classNames: string = "";
|
52
|
@Input() isH1:boolean = true;
|
53
|
|
54
|
constructor () {}
|
55
|
|
56
|
}
|