title: How to get attribute values from html in angular 4
body: <p>I am working on angular 4 project, I had a requirement to drag item, So I was using ng2-dragula plugin to do it for me. Now I need to extract data-id attribute from each row after drop to specific position.</p>
  
  <pre><code> dragulaService.drop.subscribe(
        (args) =&gt;{
          const [bagName, elSource, bagTarget, bagSource, elTarget] = args;
          console.log('after', $(bagSource)); // element after the inserted element
  });
  </code></pre>
  
  <p>In $bagSource variable I will get each rows in new order. Say it be</p>
  
  <pre><code>&lt;tr attributes  data-id="23"&gt;&lt;tr&gt;
  &lt;tr attributes  data-id="2"&gt;&lt;tr&gt;
  &lt;tr attributes  data-id="32"&gt;&lt;tr&gt;
  </code></pre>
  
  <p>How could I extract <strong>data-id</strong> from each tr fields. I need to get each id in their new order in an array.
  My required result should be [23,2,32];</p>
  
  <p>jquery $(element).attr("data-id")  equivalent in angular 4.</p>