Is there a way to load dynamic urls in templateUrl
. Something like below code :-
@Component({
moduleId: module.id,
selector: 'my-app',
templateUrl: DynamicUrl, //Load DynamicUrl here
styleUrls: ['app.component.css']
})
export class AppComponent{
var DynamicUrl= 'app.component.html';
// ideally this template name will be pulled from the server.
}
I am confused about the lifecycle. Where to initialize and define the DynamicUrl and apply the logic to fetch from server.
Any kind of help is appreciated.