Skip to content

Commit

Permalink
feat(SlideArrow): added arrowClicked event
Browse files Browse the repository at this point in the history
  • Loading branch information
flauc committed Jan 31, 2019
1 parent ecc08c5 commit 36daabe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions projects/ng-slider/src/lib/slide-arrow/slide-arrow.directive.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import {Directive, HostListener, Input} from '@angular/core';
import {
Directive,
EventEmitter,
HostListener,
Input,
Output
} from '@angular/core';
import {SlideArrowDirection} from '../enums/slide-arrow-direction.enum';
import {SliderComponent} from '../slider/slider.component';

@Directive({
selector: '[jpSlideArrow]'
})
export class SlideArrowDirective {
constructor(
private slider: SliderComponent
) {}
constructor(private slider: SliderComponent) {}

@Input('jpSlideArrow')
direction: SlideArrowDirection = SlideArrowDirection.Right;

@HostListener('click')
onClick() {
@Output()
arrowClicked = new EventEmitter<MouseEvent>();

@HostListener('click', ['$event'])
onClick(event) {
this.arrowClicked.emit(event);
this.slider.move$.next(this.direction);
}
}

0 comments on commit 36daabe

Please sign in to comment.