src/app/modules/shared/components/card/card.component.ts
selector | app-card |
templateUrl | card.component.html |
customClass
|
Type: |
data
|
content is used to render IContents value on the view
Type: |
dialCode
|
Type: |
clickEvent
|
$event type: EventEmitter
|
constructor(resourceService: ResourceService, router: Router)
|
Public onAction |
onAction(data: any, action: any)
|
Returns:
void
|
hover |
hover: |
isConnected |
isConnected: |
resourceService |
resourceService: |
route |
route: |
telemetryCdata |
telemetryCdata: |
import { ResourceService } from '../../services/index';
import { Component, OnInit, Input, EventEmitter, Output, HostListener } from '@angular/core';
import { ICard } from '../../interfaces';
import { IImpressionEventInput, IInteractEventObject } from '@sunbird/telemetry';
import { Router } from '@angular/router';
import * as _ from 'lodash-es';
@Component({
selector: 'app-card',
templateUrl: './card.component.html'
})
export class CardComponent {
/**
* content is used to render IContents value on the view
*/
@Input() data: ICard;
@Input() dialCode: string;
@Input() customClass: string;
@Output() clickEvent = new EventEmitter<any>();
telemetryCdata: Array<{}> = [];
hover: Boolean;
isConnected: Boolean = navigator.onLine;
route: string;
constructor(public resourceService: ResourceService, private router: Router) {
this.resourceService = resourceService;
if (this.dialCode) {
this.telemetryCdata = [{ 'type': 'DialCode', 'id': this.dialCode }];
}
this.route = this.router.url;
}
public onAction(data, action) {
this.clickEvent.emit({ 'action': action, 'data': data });
}
}