I followed the instructions on this page: https://www.arka.com/blog/dynamically-generate-angular-components-from-external-html
The problem was that I couldn’t read the attributes with the @Input property. Instead I used the elementRef to read the inputs:
import {Component, ElementRef, Input, OnInit} from '@angular/core';
@Component({
selector: 'test',
templateUrl: './test.component.html',
})
export class TestComponent implements OnInit {
constructor( private elementRef: ElementRef) {
let el: HTMLElement = this.elementRef.nativeElement;
console.log(el.getAttribute("question"));
this.question = el.getAttribute("question");
this.answer = el.getAttribute("answer");
}
@Input() question;
@Input() answer;
isHidden = false;
ngOnInit() {
}
}
I still don’t know how could we use content projection.