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:

URL parameters with React Router

 https://ui.dev/react-router-url-parameters If you're reading this, you're probably familiar with the idea of function parameters. T...