I am learning Angular2 from scratch, trying to figure out how to pass the name of the component to be load through a variable rather than a static call. I tried using interpolation as below but I can't get it to work.
As per example: survey.component is actually a component that just displays "hello world".
If you look at the template in the component decorator there are 2 lines which pretty much hold the same value, just one is passed with interpolation and the other is a static call.
The static line displays "Hello world", while the value interpolated pastes directly the string "< survey >< survey >" instead of the content of the "Hello world".
How would I nest a component inside a component with a variable?
I tried google, but all I can find is topics regarding communication between the 2 components not using interpolation to insert a component inside a component. Hope my question is not "to stupid".
import {Component} from 'angular2/core';
import {SurveyComponent} from './survey.component';
@Component({
selector: 'rpane',
template: `{{ componentLoad }}
<survey></survey>
`,
directives: [SurveyComponent]
})
export class RPaneComponent {
componentLoad = '<survey></survey>';
}