dnet40/modules/uoa-services-library/branches/mergeResultLandingPages/ng-openaire-library/src/app/landingPages/landing-utils/showTitle.component.ts @ 56936
1 |
import {Component, Input} from '@angular/core'; |
---|---|
2 |
import {ActivatedRoute} from '@angular/router'; |
3 |
|
4 |
@Component({ |
5 |
selector: 'showTitle', |
6 |
template: ` |
7 |
<h2 [class]="classNames">
|
8 |
<div *ngIf="title != undefined" class="landingTitle">
|
9 |
<span *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
|
10 |
class="custom-external">
|
11 |
|
12 |
<a *ngIf="title['name'] != undefined && title['name'] != ''"
|
13 |
href="{{title['url']}}" target="_blank"
|
14 |
[innerHTML]="title['name']">
|
15 |
</a>
|
16 |
<a *ngIf="title['name'] == undefined || title['name'] == ''"
|
17 |
href="{{title['url']}}" target="_blank">
|
18 |
[no title available]
|
19 |
</a>
|
20 |
</span>
|
21 |
<span *ngIf="(title['name'] != undefined && title['name'] != '') &&
|
22 |
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
23 |
[innerHTML]="title['name']">
|
24 |
</span>
|
25 |
<span *ngIf="(title['name'] == undefined || title['name'] == '') &&
|
26 |
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
|
27 |
>
|
28 |
[no title available]
|
29 |
</span>
|
30 |
</div>
|
31 |
<div *ngIf="titleName">
|
32 |
<span [innerHTML]="titleName"></span>
|
33 |
</div>
|
34 |
<div *ngIf="!titleName && !title">
|
35 |
<span>[no title available]</span>
|
36 |
</div>
|
37 |
</h2>
|
38 |
`
|
39 |
|
40 |
})
|
41 |
|
42 |
export class ShowTitleComponent { |
43 |
@Input() titleName: string; |
44 |
@Input() title: { [key: string]: string }; |
45 |
@Input() iconClass:string; |
46 |
@Input() classNames: string = ""; |
47 |
|
48 |
sub: any; |
49 |
|
50 |
constructor (private route: ActivatedRoute) {} |
51 |
|
52 |
ngOnInit() { |
53 |
this.sub = this.route.queryParams.subscribe( |
54 |
params => { |
55 |
}
|
56 |
);
|
57 |
}
|
58 |
|
59 |
ngOnDestroy() { |
60 |
this.sub.unsubscribe(); |
61 |
}
|
62 |
}
|