title: Angular2 - click event: get ID of clicked element
body: <p>I have an overview of charts (primeng) and now I need to know if it is possible to get the ID from a chart when its clicked. </p>
  
  <p>FYI I have a contextmenu which contains "open in new tab" and I need the ID from the chart the contextmenu opened on. </p>
  
  <p>Rightclick -> getID from chart -> use ID to open new Tab with only that chart being displayed. </p>
  
  <p>I've seen some stuff like event.target.attributes.id /event.currenttarget, but that's js, right? I am using Typescript. </p>
  
  <p>So the question is actually that simple: How would I be able to do this?</p>
  
  <p>I am a newbie to everything related to programming, I acutally started a few weeks ago, so please be patient as I might not be able to understand everything as quick as others would.</p>
  
  <p>Edit: </p>
  
  <p>MenuItems for context menu:</p>
  
  <pre><code>this.ctitems = [
      {
          label: 'Öffnen(neuer Tab)',
          icon: 'fa-plus',
          command: (onClick) =&gt; {this.function()}                
      },
      {
          label: 'Öffnen(dieser Tab)',
          icon: 'fa-hand-o-down'
  
      }
  ]; 
  </code></pre>
  
  <p>function to get id</p>
  
  <pre><code>function() { event.target.getID &lt;- problem }
  </code></pre>
  
  <p>As soon as I have the ID I want to push an item specified by the ID into an array of items displayed in a TabMenu. But thats future. Now I just need to get the ID.</p>
  
  <p>html: </p>
  
  <pre><code>&lt;p-chart height="100" width="100" class="ui-g-2 " type="line" id="linechart" [data]="ntwdata"&gt;&lt;/p-chart&gt;
  &lt;p-contextMenu id="cm" [model]="ctitems"&gt;&lt;/p-contextMenu&gt;
  </code></pre>