monitor/src/app/htmlPages/about/aboutPage.component.ts

46 lines
1.6 KiB
TypeScript

import {Component, Input, Output, EventEmitter, ViewChild, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import{EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
@Component({
selector: 'about',
template: `
<div class=" uk-section uk-margin-large-top tm-middle uk-container" id="tm-main">
<div class="uk-container uk-margin-bottom">
<html-page></html-page>
</div>
</div>
`
})
export class AboutPageComponent {
properties:EnvProperties;
constructor ( private route: ActivatedRoute, private _router: Router,
private _meta: Meta, private _title: Title) {}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.updateUrl(data.envSpecific.baseLink+this._router.url);
this.updateTitle("About");
this.updateDescription("About, open access");
});
}
private updateDescription(description:string){
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
}
private updateTitle(title:string){
var _prefix ="OpenAIRE | ";
var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title);
this._title.setTitle(_title);
this._meta.updateTag({content:_title},"property='og:title'");
}
private updateUrl(url:string){
this._meta.updateTag({content:url},"property='og:url'");
}
}