Fix share link generator

Transactions
= 2017-09-11 23:35:29 -06:00
parent 3a16236329
commit d6ada934ad
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { Component, AfterContentInit, Input } from '@angular/core';
import { Component, AfterContentInit, Input, Inject } from '@angular/core';
import { MdDialog, MdDialogConfig } from '@angular/material';
import { trigger, state, style, transition, animate } from '@angular/animations';
@ -71,6 +71,7 @@ export class EventLargeComponent implements AfterContentInit {
constructor(private dialog: MdDialog){
console.log(this.title);
}
ngAfterContentInit(): void{

View File

@ -1,4 +1,5 @@
import { MdDialogRef, MdSnackBar } from '@angular/material';
import { DOCUMENT } from '@angular/platform-browser';
import { MD_DIALOG_DATA } from '@angular/material';
import { Component, OnInit, Inject } from '@angular/core';
@ -20,9 +21,12 @@ export class SharePopupComponent implements OnInit {
private shareBaseUrl: string = "/api2/share/";
public shareUrl: string;
constructor(@Inject(MD_DIALOG_DATA) public data: any, private mdDialogRef: MdDialogRef<SharePopupComponent>, private snackbar: MdSnackBar) {
constructor(@Inject(MD_DIALOG_DATA) public data: any,
@Inject(DOCUMENT) private document,
private mdDialogRef: MdDialogRef<SharePopupComponent>,
private snackbar: MdSnackBar) {
this.id = data.id;
this.shareUrl = this.shareBaseUrl + data.prefix + this.id;
this.shareUrl = this.document.location.protocol +'//'+ this.document.location.hostname + ":" + this.document.location.port + this.shareBaseUrl + data.prefix + this.id;
this.facebookIframeUrl = this.urlPartA + this.shareUrl + this.urlPartB;
this.twitterUrl = this.twitterPartA + data.title + " - " + data.description + "&url=" + this.shareUrl;
}