import { Component, Input } from '@angular/core'; import {ActivatedRoute} from '@angular/router'; import {StringUtils} from '../../utils/string-utils.class'; @Component({ selector: 'feedback', template: `
Feedback
` }) export class FeedbackComponent { @Input()feedbackQuestionaire:string = ""; @Input()feedbackmail:string = "someone@example.com"; @Input()portalName:string = "Explore"; public subject:string; public body:string = "Send from page"; sub:any; constructor(private route: ActivatedRoute) {} ngOnInit() { // this.feedbackmail = OpenaireProperties.getFeedbackMail(); this.subject = "[Feedback - OpenAIRE "+this.portalName+"]"; this.initialize(); this.sub = this.route.queryParams.subscribe(params => { this.initialize(); }); } ngOnDestroy(){ this.sub.unsubscribe(); } initialize(){ var referrer = null; if (typeof location !== 'undefined') { referrer = location.href; } this.body = "[Please write your message here] \n\n\nOpenAIRE " + this.portalName + " \nSent from "+((referrer)?referrer:" [referrer not available]")+ " \n(please don't delete this part of the message)"; this.body = StringUtils.URIEncode(this.body); // this.subject = StringUtils.URIEncode(this.subject); } }