Replace Meta service Import and use with Meta and Title from angular/platform-browser for dataset.component and dataset.module

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51761 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-04-11 15:09:23 +00:00
parent 41056150fc
commit 68e52678fe
2 changed files with 49 additions and 41 deletions

View File

@ -1,12 +1,17 @@
import {Component, ViewChild, ElementRef, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {DatasetService} from './dataset.service';
import {DatasetInfo} from '../../utils/entities/datasetInfo';
import {ActivatedRoute, Router} from '@angular/router';
import {RouterHelper} from '../../utils/routerHelper.class';
import { Meta} from '../../sharedComponents/metaService';
import {PiwikService} from '../../utils/piwik/piwik.service';
import{EnvProperties} from '../../utils/properties/env-properties';
import {Component, ViewChild} from '@angular/core';
import {ElementRef, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import {DatasetInfo} from '../../utils/entities/datasetInfo';
import {EnvProperties} from '../../utils/properties/env-properties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {DatasetService} from './dataset.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({
selector: 'dataset',
@ -14,7 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
})
export class DatasetComponent {
@Input() piwikSiteId = null;
@Input() piwikSiteId = null;
public datasetInfo: DatasetInfo;
public datasetId : string ;
@ -53,6 +58,7 @@ export class DatasetComponent {
private _piwikService:PiwikService,
private route: ActivatedRoute,
private _meta: Meta,
private _title: Title,
private _router: Router) {
}
@ -152,17 +158,17 @@ export class DatasetComponent {
}
private updateDescription(description:string){
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
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._meta.setTitle(_title );
this._meta.updateProperty("og:title",_title);
this._title.setTitle(_title);
this._meta.updateTag({content:_title},"property='og:title'");
}
private updateUrl(url:string){
this._meta.updateProperty("og:url", url);
this._meta.updateTag({content:url},"property='og:url'");
}
public buildCurationTooltip() {

View File

@ -1,42 +1,44 @@
//import {MaterialModule} from '@angular/material';
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { SharedModule } from '../../shared/shared.module';
import { RouterModule } from '@angular/router';
// import {MaterialModule} from '@angular/material';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import { DatasetService} from './dataset.service';
import { DatasetComponent } from './dataset.component';
// import { DatasetRoutingModule } from './dataset-routing.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import {SharedModule} from '../../shared/shared.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {DatasetComponent} from './dataset.component';
import {MetaModule} from '../../sharedComponents/metaService.module';
import { ConfigurationServiceModule } from '../../utils/configuration/configurationService.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
// import {DatasetRoutingModule} from './dataset-routing.module';
import {LandingModule} from '../landing-utils/landing.module';
import {ResultLandingModule} from '../landing-utils/resultLanding.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module';
import {IFrameModule} from '../../utils/iframe.module';
import {DatasetService} from './dataset.service';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({
imports: [
//MaterialModule.forRoot(),
CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CiteThisModule,
ResultLandingModule, MetricsModule, IFrameModule, AltMetricsModule,
MetaModule, ConfigurationServiceModule
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule,
AltMetricsModule, ConfigurationServiceModule
],
declarations: [
DatasetComponent
DatasetComponent
],
providers:[
DatasetService, FreeGuard, IsRouteEnabled
],
],
exports: [
DatasetComponent
]
DatasetComponent
]
})
export class DatasetModule { }