import { EventEmitter, Component, Input, Output, ElementRef } from '@angular/core'; import { CardItem } from '../../pages/search/search'; @Component({ selector: 'error', templateUrl: 'error.html' }) export class Error { @Output() onClose = new EventEmitter(); @Input() cardItem: CardItem; constructor(private elementRef: ElementRef) { } close() { const d = 275; this.elementRef.nativeElement.parentElement.animate({ transform: ['none', 'translate3d(110%, 0, 0)'] }, { fill: 'forwards', duration: d, iterations: 1, easing: 'ease-in-out', }); setTimeout(() => { this.onClose.emit(this.cardItem); }, d); } }