Dynamic templateURL for component

Hi everyone!

In Angular 1, we can dynamically set the templateUrl for a directive according to an specific attribute.

Here is an example (Angular 1):


scope: {
    size: '@',
    color: '@'
templateUrl: function(elem, attrs){
    // different templateUrl according to size attribute
    return 'app/styling/tmpl.svg.stairs-' + (attrs.size || 'small') + '.svg';


How can I reproduce it in ionic2 component? (Angular 2)
There is no ability to access @Input value inside templateUrl function right?

Can you help me @mhartington , @bengtler?

Any help will be appreciated.

Thanks in advance!

this is not possible in this way --> but you can create child components based on your inputs.


Thanks for your reply @bengtler.

I’ve been testing it today without success.
Could you write a simple example to guide me a bit, please?

Thank you!