So I got these components, classes B and C with different template, as seen below.
@Component({})
export abstract class A {}
@Component({
template: `BBBBBB`
})
export class B extends A{}
@Component({
template: `CCCCCC`
})
export class C extends A{}
In my main component I need to iterate trough an array of A, and insert its template to the HTML.
@Component({
template: `
<div>
...???...
</div>
`
})
export class MrModul {
anArray: A[] = Array();
constructor(){
...
//filling up the Array
...
}
}
So I need to fill the place with the '???' with the appropriate template, while i'm iterating through the array, but I don't really know how. If I use selectors I don't really know what selector to use. But if I use *ngFor
i don't know what attribute I should use.
Can you guys help me? Thx!
Bonus info: The goal is to have someting like a widget system. You can choose and add a random type of - lets call it - widget, and they will be put into a new div. This what the array is for, to store the new widget.