Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. @Directive({
  2. selector: '[appClickCount]'
  3. })
  4. export class ClickCountDirective {
  5. clickCount: number;
  6.  
  7. @Input('clickCountColor') color: string;
  8. @Output() clickCountChange = new EventEmitter<number>();
  9. @HostListener('click') click() { ... }
  10. @HostBinding('class.clicked') clicked: boolean;
  11.  
  12. constructor(
  13. private elementRef: ElementRef,
  14. ) { }
  15. }
  16.  
  17. /****************** Use case *********************
  18.  
  19. <button appClickCount
  20. clickCountColor="red"
  21. (clickCountChange)="clickCount = $event">
  22. Click Me!
  23. <button>
  24.  
  25. **************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement