Revision 51838
Added by Sofia Baltzi about 6 years ago
communities.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; |
2 |
import {Observable} from 'rxjs/Observable'; |
|
3 | 2 |
import {ActivatedRoute, Router} from '@angular/router'; |
4 | 3 |
import {Location} from '@angular/common'; |
4 |
import {Title, Meta} from '@angular/platform-browser'; |
|
5 |
import {Observable} from 'rxjs/Observable'; |
|
6 |
|
|
5 | 7 |
import "rxjs/add/observable/zip"; |
6 |
import {Meta} from '../openaireLibrary/sharedComponents/metaService'; |
|
8 |
|
|
7 | 9 |
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; |
8 | 10 |
|
9 | 11 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
10 | 12 |
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
11 | 13 |
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; |
12 | 14 |
|
13 |
|
|
14 | 15 |
@Component({ |
15 | 16 |
selector: 'communities', |
16 | 17 |
templateUrl: 'communities.component.html', |
... | ... | |
20 | 21 |
public subfunders: any; |
21 | 22 |
|
22 | 23 |
public pageTitle = "OpenAIRE" |
23 |
properties:EnvProperties; |
|
24 |
properties:EnvProperties;
|
|
24 | 25 |
|
25 |
|
|
26 | 26 |
constructor ( |
27 | 27 |
private route: ActivatedRoute, |
28 |
private _router: Router, |
|
29 |
private location: Location, private _meta: Meta,private _piwikService:PiwikService, |
|
30 |
private config: ConfigurationService |
|
31 |
) { |
|
28 |
private _router: Router, |
|
29 |
private location: Location, |
|
30 |
private _meta: Meta, |
|
31 |
private _title: Title, |
|
32 |
private _piwikService:PiwikService, |
|
33 |
private config: ConfigurationService) { |
|
32 | 34 |
|
35 |
var description = "open access, research, research community, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; |
|
36 |
var title = "OpenAIRE Connect"; |
|
33 | 37 |
|
34 |
var description = "open access, research, research community, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; |
|
38 |
this._title.setTitle(title); |
|
39 |
this._meta.updateTag({content:description},"name='description'"); |
|
40 |
this._meta.updateTag({content:description},"property='og:description'"); |
|
41 |
this._meta.updateTag({content:title},"property='og:title'"); |
|
35 | 42 |
|
36 |
var title = "OpenAIRE Connect";
|
|
43 |
}
|
|
37 | 44 |
|
38 |
this._meta.setTitle(title); |
|
39 |
this._meta.updateMeta("description", description); |
|
40 |
this._meta.updateProperty("og:description", description); |
|
41 |
this._meta.updateProperty("og:title", title); |
|
45 |
public ngOnInit() { |
|
46 |
this.route.data |
|
47 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
48 |
this.properties = data.envSpecific; |
|
49 |
var url = data.envSpecific.baseLink+this._router.url |
|
50 |
this._meta.updateTag({content:url},"property='og:url'"); |
|
51 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
52 |
this.piwiksub = this._piwikService.trackView(this.properties,"OpenAIRE").subscribe(); |
|
53 |
} |
|
42 | 54 |
|
55 |
}); |
|
56 |
} |
|
43 | 57 |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
public ngOnInit() { |
|
48 |
this.route.data |
|
49 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
50 |
this.properties = data.envSpecific; |
|
51 |
var url = data.envSpecific.baseLink+this._router.url |
|
52 |
this._meta.updateProperty("og:url", url); |
|
53 |
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ |
|
54 |
this.piwiksub = this._piwikService.trackView(this.properties,"OpenAIRE").subscribe(); |
|
55 |
} |
|
56 |
|
|
57 |
}); |
|
58 |
} |
|
59 | 58 |
public ngOnDestroy() { |
60 | 59 |
if(this.piwiksub){ |
61 | 60 |
this.piwiksub.unsubscribe(); |
Also available in: Unified diff
Replace meta service import and use with meta and title from angular/platform-browser for communities and statistics