openaire-library/landingPages/landing-utils/schema2jsonld/schema2jsonld.component.ts

26 lines
745 B
TypeScript

import {Component, ElementRef, Input} from '@angular/core';
import { OpenAireJsonldConverterService } from './service/open-aire-jsonld-converter.service';
import { JsonldDocumentSerializerService } from './service/jsonld-document-serializer.service';
@Component({
selector: 'schema2jsonld',
template: `
<ngx-json-ld [json]="json"></ngx-json-ld>
`
})
export class Schema2jsonldComponent {
@Input() data;
@Input() URL;
json;
constructor( private documentParser: OpenAireJsonldConverterService,
private documentSerializer: JsonldDocumentSerializerService) {
}
ngOnInit() {
const docOvject = this.documentParser.convertPublication(this.data, this.URL);
this.json = this.documentSerializer.serialize(docOvject);
}
}