File

src/app/modules/shared/components/share-link/share-link.component.ts

Metadata

selector app-share-link
templateUrl share-link.component.html

Inputs

shareLink

input for Sharelink;

Type: string

telemetryShareData

input for telemetryShare;

Type: ITelemetryShare[]

Outputs

close

Output for Sharelink;

$event type: EventEmitter

Constructor

constructor(resourceService: ResourceService, _renderer: Renderer2)

Refrence of UserService
Constructor to create injected service(s) object
Default method of unpublished Component class

Methods

popDeny
popDeny(pop: any)

popDenys

Returns: void
initializeModal
initializeModal()

initializeModal

Returns: void
Public copyLink
copyLink(popup: IPopup)

copyLink
{object} copyLinkData -element ref
{object} popup -element ref

Returns: void
Public closeModal
closeModal(contentShareModal: any)
Returns: void

Properties

Public baseUrl
baseUrl: string

baseUrl;

copyLinkButton
copyLinkButton: any

Element Ref for copyLinkButton;

position
position: string

position for the popup

Public resourceService
resourceService: ResourceService

Element Ref for copyLinkData;
To call resource service which helps to use language constant

sharelinkModal
sharelinkModal: boolean
Default value: false

To show / hide modal

telemetryShare
telemetryShare: any
import { IShareEventData, IShareEventInput } from '@sunbird/telemetry';
import {
  Component, OnInit, Input, EventEmitter,
  ElementRef, ViewChild, Renderer2, Output
} from '@angular/core';
import { ResourceService } from '../../services/index';
import { IPopup } from 'ng2-semantic-ui-v9';
import { ISharelink, ITelemetryShare } from './../../interfaces';
@Component({
  selector: 'app-share-link',
  templateUrl: './share-link.component.html'
})
export class ShareLinkComponent implements OnInit {
  /**
  * position for the popup
  */
  position: string;
  /**
   * To show / hide modal
  */
  sharelinkModal = false;
  /**
  *baseUrl;
  */
  public baseUrl: string;
  telemetryShare: IShareEventData;
  /**
  *input for Sharelink;
  */
  @Input() shareLink: string;
  /**
  *input for telemetryShare;
  */
  @Input() telemetryShareData: Array<ITelemetryShare> = [];
  /**
  *Output for Sharelink;
  */
  @Output() close = new EventEmitter<any>();
  /**
  *Element Ref  for copyLinkButton;
  */
  @ViewChild('copyLinkButton') copyLinkButton: ElementRef;
  /**
  *Element Ref  for copyLinkData;
  */
  // @ViewChild('copyLinkData') copyLinkData: ElementRef;
  /**
  * To call resource service which helps to use language constant
  */
  public resourceService: ResourceService;
  /**
  * Refrence of UserService
  */
  /**
  * Constructor to create injected service(s) object
  *Default method of unpublished Component class
  *@param {ResourceService} SearchService Reference of SearchService
  *@param {WorkSpaceService} WorkSpaceService Reference of SearchService
  */
  constructor(resourceService: ResourceService, private _renderer: Renderer2) {
    this.resourceService = resourceService;
    this.position = 'top center';
    this.baseUrl = document.location.origin + '/';
  }
  ngOnInit() {
    this.initializeModal();
  }
  /**
  * popDenys
  */
  popDeny(pop) {
    pop.close();
  }
  /**
  * initializeModal
  */
  initializeModal() {
    setTimeout(() => {
      if (this.copyLinkButton) {
        this.copyLinkButton.nativeElement.click();
      }
    }, 300);
    this.telemetryShare = {
      type: 'Link',
      dir: 'out',
      items: this.telemetryShareData
    };
  }
  /**
  * copyLink
  * {object}  copyLinkData -element ref
  * {object}  popup -element ref
  */
  public copyLink(popup: IPopup) {
    popup.open();
    $('#copyLinkData').select();
    document.execCommand('copy');
  }

  public closeModal(contentShareModal) {
    contentShareModal.deny();
    this.close.emit();
  }
}

results matching ""

    No results matching ""