Created
July 2, 2017 21:55
-
-
Save stevermeister/984d51a6a97082af3c9031105a3c13e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive, Output, EventEmitter, HostListener } from '@angular/core'; | |
@Directive({ | |
selector: '[logClicks]' | |
}) | |
export class LogClicksDirective { | |
public couter = 0; | |
@Output() changes = new EventEmitter(); | |
@HostListener('click', ['$event.target']) | |
onclick(target) { | |
this.couter++; | |
console.log(target); | |
this.changes.emit(this.couter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment