Routing through states

Hello,
I’m trying to construct an app that has multiple pages. When in browsing through the states I have a situation that requires routing like it is in the example described below.

.state('listing', {
    url: '/:catpai',
   controller: 'ListingCtrl',
  templateUrl: 'controllers/listing/listing.html'
})
 .state('pdi', {
     url: '/:catpai/:pdi',
     controller: 'PdiCtrl',
    templateUrl: 'controllers/pdi/pdi.html'
});

The problem is that, everytime that I access the pdi state, I lose my catpai variable. How can I write the code in a way that I dont lose that variable?

You need to share data , read this article may be helpful http://www.codeandyou.com/2015/09/share-data-between-controllers-in-angularjs.html

Thanks! I’ll look into it :smile: