I'm trying to inject angular component into parent component, with [innerHTML] attribute, I only get the HTML code, it does not compile to my child component
My child component:
@Component({
selector: 'text-step',
styleUrls: ['./text.scss'],
templateUrl: 'text.html',
})
export class TextStepComponent implements OnInit {
@Input() step: object;
constructor(
) { }
ngOnInit() {
}
}
My parent component:
renderSteps(listSteps) {
var context = this;
var result = '';
listSteps.forEach(function(step) {
switch (step.type) {
case 'form_text':
context.innerHtml += '<text-step [step]=\"' + step + '\"></text-step>';
break;
}
});
}
It means with each step will append a text-step component to a div
How can I do this?