Answers for "angular directive output"

1

output event angular

@Component({...})
export class CounterComponent {

  @Input()
  count: number = 0;

  @Output()
  change: EventEmitter<number> = new EventEmitter<number>();

  increment() {
    this.count++;
    this.change.emit(this.count);
  }

  decrement() {
    this.count--;
    this.change.emit(this.count);
  }

  	// in parent component
	//(change)="countChange($event)"> 

}
Posted by: Guest on October-19-2020
1

angular directive output

// just use it normal
@Output() itch:EventEmitter<any> = new EventEmitter();

//and call in html
<div appCollar (itch)='scratch()' >
Posted by: Guest on August-13-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language