2017-08-24 10:54:15 -04:00
|
|
|
import { EventEmitter, Component, Input, Output, ElementRef } from '@angular/core';
|
|
|
|
import { CardItem } from '../../pages/search/search';
|
2017-01-03 23:51:25 -05:00
|
|
|
|
|
|
|
@Component({
|
2017-08-24 10:54:15 -04:00
|
|
|
selector: 'error',
|
|
|
|
templateUrl: 'error.html'
|
2017-01-03 23:51:25 -05:00
|
|
|
})
|
|
|
|
export class Error
|
|
|
|
{
|
|
|
|
@Output()
|
|
|
|
onClose = new EventEmitter<CardItem>();
|
2017-01-26 22:26:48 -05:00
|
|
|
|
2017-01-03 23:51:25 -05:00
|
|
|
@Input()
|
|
|
|
cardItem: CardItem;
|
|
|
|
|
2017-01-28 11:42:48 -05:00
|
|
|
constructor(private elementRef: ElementRef)
|
2017-01-03 23:51:25 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
close()
|
|
|
|
{
|
2017-08-24 10:54:15 -04:00
|
|
|
const d = 275;
|
2017-01-28 11:42:48 -05:00
|
|
|
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);
|
2017-01-03 23:51:25 -05:00
|
|
|
}
|
2017-08-24 10:54:15 -04:00
|
|
|
}
|