I have a component belonging to a custom library:
<my-icon>
In order to have the icon, I should set the property [name] of this component. Something like this:
<my-icon [name]='warning'></my-icon>
I am dinamically creating these icons with TypeScript:
if (myCondition) {
let icon = <HTMLElement>document.createElement('my-icon');
}
How should I set the property [name] in my variable icon in order to have the same result than above?
I've tried icon.setAttribute('name','warning') but it doesn't work (that sets the HTML attribute name, and not the input name of the underlying Angular component.
Renderer2to manipulate DOM. It has also methods tosetProperty,setAttributeetc