Routing through states

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

Thanks! I’ll look into it :smile: