Apply a directive on a DOM element using getElementById in angular 7
问题 I have some HTML generated by a third party (plotly), and I would love to apply a directive that we already have on one of the DOM elements it creates. The directive opens a colorPicker on click and sets colors to strings. I can reach the element with querySelector , or getElementById , but how can I transform / wrap it into angular can add a directive to? I tried: const el = document.getElementById('myEl'); const comp = new ElementRef(el) or: const comp = this.renderer.selectRootElement(el)