Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Directive({
- selector: '[appClickCount]'
- })
- export class ClickCountDirective {
- clickCount: number;
- @Input('clickCountColor') color: string;
- @Output() clickCountChange = new EventEmitter<number>();
- @HostListener('click') click() { ... }
- @HostBinding('class.clicked') clicked: boolean;
- constructor(
- private elementRef: ElementRef,
- ) { }
- }
- /****************** Use case *********************
- <button appClickCount
- clickCountColor="red"
- (clickCountChange)="clickCount = $event">
- Click Me!
- <button>
- **************************************************/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement