File

src/app/modules/shared-feature/components/cert-preview-popup/cert-preview-popup.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs
HostListeners

Constructor

constructor(resourceService: ResourceService, sanitizer: DomSanitizer)
Parameters :
Name Type Optional
resourceService ResourceService No
sanitizer DomSanitizer No

Inputs

template
Type : any

Outputs

close
Type : EventEmitter

HostListeners

window:popstate
Arguments : '$event'
window:popstate(event)

Methods

certTemplateURL
certTemplateURL(url)
Parameters :
Name Optional
url No
Returns : any
closeModal
closeModal(name?)
Parameters :
Name Optional
name Yes
Returns : void
ngOnInit
ngOnInit()
Returns : void
onPopState
onPopState(event)
Decorators :
@HostListener('window:popstate', ['$event'])
Parameters :
Name Optional
event No
Returns : void

Properties

modal
Decorators :
@ViewChild('modal')
Public resourceService
Type : ResourceService
import { Component, OnInit, Input, Output, EventEmitter, ViewChild, HostListener } from '@angular/core';
import { ResourceService } from '@sunbird/shared';
import { DomSanitizer } from '@angular/platform-browser';

@Component({
  selector: 'app-cert-preview-popup',
  templateUrl: './cert-preview-popup.component.html',
  styleUrls: ['./cert-preview-popup.component.scss']
})
export class CertPreviewPopupComponent implements OnInit {

  @Input() template;
  @Output() close = new EventEmitter();
  @ViewChild('modal') modal;

  constructor(public resourceService: ResourceService,
    private sanitizer: DomSanitizer) { }

  @HostListener('window:popstate', ['$event'])
  onPopState(event) {
   this.modal.deny();
  }

  ngOnInit() {
  }

  closeModal(name?) {
    if (this.modal) {
      this.modal.deny();
    }
    this.close.emit({name, template: this.template});
  }

  certTemplateURL(url) {
    if (url) {
      return this.sanitizer.bypassSecurityTrustResourceUrl(url);
    }
  }
}
<app-modal-wrapper [config]="{disableClose: true, size: 'normal'}" (dismiss)="closeModal()" #modal>
  <ng-template sbModalContent>
    <div class="sb-modal">
      <div class="transition ui dimmer page modals active visible">
        <div class="ui modal transition active visible normal">
          <div class="sb-modal-header">
            {{resourceService?.frmelmnts?.cert?.lbl?.certPreview }}
          </div>
          <div class="sb-modal-content">
            <div class="cert-preview-img"><img [src]="certTemplateURL(template?.artifactUrl)"></div>
          </div>
          <div class="sb-modal-actions">
            <button class="sb-btn sb-btn-normal sb-btn-outline-primary" tabindex="0" (click)="closeModal('select')">
              {{resourceService?.frmelmnts?.cert?.lbl?.selectTemplate}}
            </button>
            <button class="sb-btn sb-btn-normal sb-btn-outline-primary" tabindex="0" (click)="closeModal()">
              {{resourceService?.frmelmnts?.btn?.close}}
            </button>
          </div>
        </div>
      </div>
    </div>
  </ng-template>
</app-modal-wrapper>

./cert-preview-popup.component.scss


Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""