File

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

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(resourceService: ResourceService, _renderer: Renderer2, activatedRoute: ActivatedRoute)

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

Parameters :
Name Type Optional
resourceService ResourceService No
_renderer Renderer2 No
activatedRoute ActivatedRoute No

Inputs

shareLink
Type : string

input for Sharelink;

telemetryInteractEdata
Type : { id: string; type: string; pageid: any; }
Default value : { id: 'content-share-link-btn', type: 'click', pageid: this.activatedRoute.snapshot.data.telemetry.env }
telemetryShareData
Type : Array<ITelemetryShare>
Default value : []

input for telemetryShare;

Methods

Public copyLink
copyLink(popup: IPopup)

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

Parameters :
Name Type Optional
popup IPopup No
Returns : void
initializeModal
initializeModal()

initializeModal

Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

Public activatedRoute
Type : ActivatedRoute
Public baseUrl
Type : string

baseUrl;

copyLinkButton
Type : ElementRef
Decorators :
@ViewChild('copyLinkButton')

Element Ref for copyLinkButton;

position
Type : string

position for the popup

Public resourceService
Type : ResourceService

To call resource service which helps to use language constant

telemetryShare
Type : IShareEventData
import { IShareEventData } from '@sunbird/telemetry';
import { Component, OnInit, Input, ElementRef, ViewChild, Renderer2 } from '@angular/core';
import { ResourceService } from '../../services/index';
import { IPopup } from 'ng2-semantic-ui-v9';
import { ITelemetryShare } from './../../interfaces';
import { ActivatedRoute } from '@angular/router';
@Component({
  selector: 'app-share-link',
  templateUrl: './share-link.component.html',
  styleUrls: ['./share-link.component.scss']
})
export class ShareLinkComponent implements OnInit {
  /**
  * position for the popup
  */
  position: string;
  /**
  *baseUrl;
  */
  public baseUrl: string;
  telemetryShare: IShareEventData;
  /**
  *input for Sharelink;
  */
  @Input() shareLink: string;
  /**
  *input for telemetryShare;
  */
  @Input() telemetryShareData: Array<ITelemetryShare> = [];
  @Input() telemetryInteractEdata = {
    id: 'content-share-link-btn',
    type: 'click',
    pageid: this.activatedRoute.snapshot.data.telemetry.env
  };
  /**
  *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, public activatedRoute: ActivatedRoute) {
    this.resourceService = resourceService;
    this.position = 'top center';
    this.baseUrl = document.location.origin + '/';
  }
  ngOnInit() {
    this.initializeModal();
  }
  /**
  * initializeModal
  */
  initializeModal() {
    setTimeout(() => {
      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');
  }
}
<div class="sb-mat__modal">

  <!--Header-->
  <div mat-dialog-title class="mb-0">
    <div class="title" role="heading" aria-level="2" appTelemetryShare [TelemetryShareEdata]="telemetryShare">
      {{resourceService?.frmelmnts?.lbl?.share}}
    </div>
    <button aria-label="close dialog" mat-dialog-close class="close-btn"></button>
  </div>
  <!--/Header-->

  <!--Content-->
  <mat-dialog-content>
    <div class="sb-mat__modal__content">
      <p class="mb-8" attr.aria-label="{{resourceService?.frmelmnts?.lbl?.arialabelShare}}">
        {{resourceService?.frmelmnts?.lbl?.sharelink}}
      </p>
      <div class="ui action input fluid" id="buttonPopUp" suiPopup [popupPlacement]="position" popupTrigger="manual"
        popupText="{{resourceService?.frmelmnts?.lbl?.linkCopied}}" #popup="suiPopup">
        <input type="text" id="copyLinkData" name="title" readonly [(ngModel)]="shareLink" aria-label="copy link data"
          class="sb-form-control" />
        <button class="ui basic primary button" tabindex="0" (click)="copyLink(popup)" appTelemetryInteract
          [telemetryInteractEdata]="telemetryInteractEdata" [telemetryInteractObject]="telemetryShareData[0]"
          #copyLinkButton>
          {{resourceService?.frmelmnts?.btn?.copyLink}}
        </button>
      </div>
    </div>
  </mat-dialog-content>

  <div class="sb-mat__modal__actions"></div>

  <!--/Content-->
</div>

./share-link.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""