title: Angular 6 - Add Event handler to dynamically created html element
body: <p>I want to attach a click event to the dynamically created html element. The click event will should be able to fire another method in component.</p>
  
  <p>I have already gone through other SO answers suggesting to use ElementRef to attach event. But, its not working for my case.</p>
  
  <p>I am using mapQuest API to render map. The map will have geocode plotted &amp; it will add a roll over content. To add the rollover content I am using the API method of mapQuest, like <code>info.setInfoContentHTML('&lt;a&gt;click me&lt;/a&gt;');</code></p>
  
  <p>Just for reference: <a href="https://developer.mapquest.com/documentation/javascript-api/pois-infowindows/" rel="nofollow noreferrer">https://developer.mapquest.com/documentation/javascript-api/pois-infowindows/</a></p>
  
  <p>The link will be inside the popup which will be added to the dom dynamically by plugin when user hover on the icon. How to add event listener on the link which is shown only when the user hover over &amp; there is no callback event provided by plugin which can fire after hover popup is displayed.</p>
  
  <p>I was looking for jQuery live like functionality which would attach event listener though the element is not on the DOM.</p>