Dynamic template from url


#1
.state('tab.home-detail', {
url: '/home/:homeId',
views: {
  'tab-home': {
    templateUrl: 'templates/home-detail**:homeId**.html',
    controller: 'HomeDetailCtrl'
  }
}

})

I want to make tymplateUrl dynamic. So that when :homeId=01 then templateUrl will be ‘template/home-detail01.html’ when :homeId is 05 then templateUrl will be ‘template/home-detail05.html’

How can I do that. In the above code I tried, but did not get result. Plz help


How to dynamically pass parameter to ionic tabs templateUrl?
#2

Hi,
Since the url have to be dynamically changed you should use a function.You have to use route like this.

 templateUrl: ['$stateParams', function ($stateParams) {
        return 'templates/home-detail' + $stateParams.homeId + '.html';
    }],

#3

I tried using this technique to do the same with my app but its not working. I have better detailed code in this link: How to dynamically pass parameter to ionic tabs templateUrl? -

When I click on the Tabs list ion-item, its supposed to go a unique page that is defined in “menu.url” (defined within the .factory(). ). What am I missing here?