Pass parameters with EventEmitter

Source: https://stackoverflow.com/questions/35390765/pass-parameters-with-eventemitter


@Output() stopSort = new EventEmitter();
EventEmitter supports one argument, which is passed as $event to your event handler.
Wrap your parameters in an event object when you pass it to emit:
this.stopSort.emit({ event:event, ui: ui });
Then, when you handle the event, use $event:
stopSort($event) { 
  alert('event param from Component: ' +$event.event);
  alert('ui param from Component: ' + $event.ui);
}

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...