У меня есть следующее:
export class MyComponent implements ng.IComponentOptions {
public static componentName: string = "myViewer";
public bindings: any;
public controller: any;
public controllerAs: any;
public templateUrl: string;
constructor() {
this.bindings = {
configName: '@'
};
this.controllerAs = "ctrl";
this.controller = MyController;
this.templateUrl = 'scripts/components/my-viewer/my-viewer.html';
}
}
Я хочу иметь возможность динамически указывать templateURL, включая его в привязки:
this.bindings = {
configName: '@',
templateURL: '=?'
};
И затем использовать функцию дляtemplateURL (см. https://ng -table.com / api-docs / interfaces / angular.icomponentoptions.html )
В предварительно набранной версии кода я мог бы сделать что-то вроде:
templateUrl: function ($element, $attrs) {
return '<SomeLogicToChooseTheTemplate>';
}
Как я могу заставить что-то подобное работать в версии Typescript?