1
|
import {Component, Input} from '@angular/core';
|
2
|
import {ActivatedRoute} from '@angular/router';
|
3
|
|
4
|
@Component({
|
5
|
selector: 'showTitle',
|
6
|
template: `
|
7
|
<h2 *ngIf="title != undefined">
|
8
|
<!--span [class]="'entityTitleIcon '+iconClass"></span-->
|
9
|
<span *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
|
10
|
class="custom-external">
|
11
|
<!--span class=" custom-icon {{title['accessMode']}}"
|
12
|
uk-tooltip="pos:bottom-right"
|
13
|
[title]="title['accessMode']"-->
|
14
|
<a *ngIf="title['name'] != undefined && title['name'] != ''"
|
15
|
href="{{title['url']}}" target="_blank"
|
16
|
[innerHTML]="title['name']">
|
17
|
</a>
|
18
|
<a *ngIf="title['name'] == undefined || title['name'] == ''"
|
19
|
href="{{title['url']}}" target="_blank">
|
20
|
[no title available]
|
21
|
</a>
|
22
|
<!--/span-->
|
23
|
</span>
|
24
|
<span *ngIf="(title['name'] != undefined && title['name'] != '') &&
|
25
|
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
26
|
[innerHTML]="title['name']">
|
27
|
</span>
|
28
|
<span *ngIf="(title['name'] == undefined || title['name'] == '') &&
|
29
|
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
30
|
>
|
31
|
[no title available]
|
32
|
</span>
|
33
|
</h2>
|
34
|
<!--[class]="title['accessMode']"
|
35
|
uk-tooltip="pos:bottom-right"
|
36
|
[title]="title['accessMode']"
|
37
|
[innerHTML]="title['name']" -->
|
38
|
`
|
39
|
|
40
|
})
|
41
|
|
42
|
export class ShowTitleComponent {
|
43
|
@Input() title: { [key: string]: string };
|
44
|
@Input() iconClass:string;
|
45
|
|
46
|
sub: any;
|
47
|
|
48
|
constructor (private route: ActivatedRoute) {}
|
49
|
|
50
|
ngOnInit() {
|
51
|
this.sub = this.route.queryParams.subscribe(
|
52
|
params => {
|
53
|
console.info("onInit showTitle");
|
54
|
|
55
|
if(this.title['accessMode'] == undefined) {
|
56
|
this.title['accessMode'] = "";
|
57
|
}
|
58
|
}
|
59
|
);
|
60
|
}
|
61
|
|
62
|
ngOnDestroy() {
|
63
|
console.info("onDestroy showTitle");
|
64
|
this.sub.unsubscribe();
|
65
|
}
|
66
|
}
|