angular2-component-outlet
angular2-component-outlet copied to clipboard
Using selected components template
I don't want to provide the template to the dynamic component I want to use the one on the type being injected.
e.g.
@Component({
template: 'Hello World, <-- use this template
selector: 'hello-world'
})
public class HelloWorldComponent{}
<div *componentOutlet="context: self; selector:'hello-world'"></div>
See #14
Just replace DynamicComponent with the HelloWorldComponent. I'm not sure if you run into problems, if your ComponentOutlet-Selector and DynamicComponent-Selector are identical. Just to be safe replace
<div *componentOutlet="context: self; selector:'hello-world'"></div>
with
<div *componentOutlet="context: self; selector:'my-dynamic-component'"></div>
I want a repro. You can use a base plunker if you need. https://plnkr.co/edit/dhRQ3U?p=preview