src/app/modules/shared-feature/components/cert-preview-popup/cert-preview-popup.component.ts
OnInit
selector | app-cert-preview-popup |
styleUrls | ./cert-preview-popup.component.scss |
templateUrl | ./cert-preview-popup.component.html |
Properties |
|
Methods |
Inputs |
Outputs |
HostListeners |
constructor(resourceService: ResourceService, sanitizer: DomSanitizer)
|
|||||||||
Parameters :
|
template | |
Type : any
|
|
close | |
Type : EventEmitter
|
|
window:popstate |
Arguments : '$event'
|
window:popstate(event)
|
certTemplateURL | ||||
certTemplateURL(url)
|
||||
Parameters :
Returns :
any
|
closeModal | ||||
closeModal(name?)
|
||||
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
onPopState | ||||
onPopState(event)
|
||||
Decorators :
@HostListener('window:popstate', ['$event'])
|
||||
Parameters :
Returns :
void
|
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