Passing parameters to abstract state with tabs


#1

Hi all,

A small question here: I have a list view, in which there are item. Whenever I click on an item, a detailed view is opened, which contains some tabs at the top, with some detail information at the bottom.

However, there’s a small issue with my setup, and I can’t figure it out. In the list view, I have urls like: /restaurant/1. The parameter 1 is passed to the tabs and to page below that. This is done with an abstract state and a mapping in the routes, like this:

  .state('restaurant', {
  url: "/restaurant",
  abstract: true,
  templateUrl: "templates/restaurant/tabs.html"
})
.state('restaurant.restaurant-tabs', {
url: '/:restaurantId',
views: {
  'restaurant-tabs': {
    templateUrl: 'templates/restaurant/tabs.html',
    controller: 'RestaurantCtrl'
  }
}

However, I want to use the :restaurantId in the tabs, because I need it to create links like: #/restaurant/{{restaurant.id}}/menu and #/restaurant/{{restaurant.id}}/location. This is the problem. In the I can access the restaurant loaded from the controller by using the param. However, in my tabs.html, when I access the restaurant, it’s not defined, and no matter what I try, I can’t get it to work.

If someone can give me a hint, that would be most appreciated. All the code can be found here: https://github.com/bodiam/ionic-lunch/

Thanks,

Erik


#2

I’m having the same problem… Did you find any solutions?


#3

No, unfortunately not.


#4

save the state is in service that lets you know what the currently selected restaurant object is? That is my first guess… but with a simpler example I might be able to have a better solution