I'm executing the following method when the user clicks a button.
@ViewChild("privs") privs: ElementRef;
addPrivs() {
this.privs.nativeElement
.insertAdjacentHTML('beforeend', '<generic1>yey!</generic1>');
}
My markup looks like this.
<generic1>woosh</generic1>
<div #privs></div>
The subcomponent named generic1 is declared like this and, of course, present in imports of the module.
import { Component } from "@angular/core";
@Component({
selector: "generic1",
template: "<div>mamba...</div>"
})
export class Generic1 { }
The behavior I'm getting is that the statistically created one in the markup shows as supposed to. The dynamically appended don't. According to the DOM as I investigate, a tag generic1 is added but it's not rendered by Angular (I see the text yey! and the tag but not the rendition of the component).
What am I missing?
I've googled for examples but didn't see anything specifically wrong with my set up. Must be something outside of my scope...