I wanted to load vendor specific html template for my component. Below is a code snippet. Problem is, I am getting resolved text string as an output instead of actual template. Can someone help me understand what's going wrong here?
Code Snippet:
import { Component, OnInit } from '@angular/core';
import {environment} from '../../environments/environment';
const helplineTemplate: string = './vendors/helpline.'+environment.vendor_prefix+'.component.html';
@Component({
selector: 'app-helpline',
templateUrl: helplineTemplate,
styleUrls: ['./helpline.component.css']
})
export class HelplineComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Output which I am getting:
./vendors/helpline.google.component.html
here google is variable which is coming from environment file. environment.vendor_prefix
This is probably not a duplicate question to this. I am actually trying to understand the strange behaviour. Although its a templateUrl
, it is still behaving like template
. Also the variable value is getting resolved before compiler hits class decorator.