title: Array of Events in Angular
body: <p>I am using angular 5 for my project. I am trying to emit event from a child component like</p>
  
  <pre><code>@Output studentUpdated:EventEmitter&lt;any&gt; = new EventEmitter()
  updated(e){
     this.studentUpdated.emit(e);
  }
  </code></pre>
  
  <p>and listing in parent component like </p>
  
  <pre><code>&lt;student (studentUpdated)="showSuccess($event)" /&gt;
  </code></pre>
  
  <p>Which work as expected. However in my student component I need to implement several events. e.g. saved, updated, deleted, confirmed, scheduled... etc </p>
  
  <p>I was thinking instead of writing one event per line and calling them individually, is there a possibility that we can initialize array of events and execute them as needed. e.g.</p>
  
  <pre><code>  @Output() events:EventEmitter&lt;any&gt;[] = []
    for(var keyNum in arrayOfEvents)
    {
          var key = arrayOfEvents[keyNum];
          this.events.push(new EventEmitter())
    }
  </code></pre>
  
  <p>Then on certain event we emit the event based on index.</p>
  
  <pre><code>this.events[0].emit(e)
  </code></pre>
  
  <p>If we can then how can we do that and also how can we listen to that event on parent component ?</p>