How can I set up the template Url dynamically?

Hey folks,

I have a provider, that contains a bunch of global variables. Those are filled/set when the app is beeing initialized by “platform.ready()…”.

Now - what I would like to do - I would like to access thos variables at another point, for example when I set the template Url from on off the subpages, but It won’t work.

import {Page} from 'ionic-angular';
import {GlobalVars} from '../../providers/globalVars';

  templateUrl: 'build/pages/subpage/subpage.html',
  /*function(vars: GlobalVars) {
    return 'build/pages/subpage/subpage.html';
  providers: [GlobalVars]
export class SubpagePage {
  constructor(vars: GlobalVars) {

What I need is - if the vars.template_type equals “desktop” it should load the template “./subpage/subpage-desktop.html” instead of “./subpage/subpage.html”.

Does any one have a solution for this issue?

Thanks in advance,