there is idea to achieve it if we create custom annotation for component and use it we can get metadata from api like from jsp file and add it to template instead templateUrl
I haven't created sample code but the rough idea is here ->
export function CustomComponent(annotation: any) {
return function (target: Function) {
// call your database and get your string here
var parentTarget = Object.getPrototypeOf(target.prototype).constructor;
var parentAnnotations = Reflect.getMetadata('annotations', parentTarget);
var parentAnnotation = parentAnnotations[0];
Object.keys(parentAnnotation).forEach(key => {
if (isPresent(parentAnnotation[key])) {
if (!isPresent(annotation[key])) {
annotation[key] = parentAnnotation[key];
}
}
});
var metadata = new ComponentMetadata(annotation);
Reflect.defineMetadata('annotations', [ metadata ], target);
};
};
and use it like
@CustomComponent({
selector: 'sub'
})
export class SubComponent {
}