UI routing with complex URL mapping


I’m using Angular StateProvider for an Ionic App. Following are the states:

$stateProvider.state('start', {
url: '/sign-in',
templateUrl: 'templates/login.html',
controller:  'loginController'

 $stateProvider.state('pageshow', {
  url: '/dashboard',
  templateUrl: 'templates/page_titles.html',
  controller:  'pageController',
$stateProvider.state('titledetail', {
  url: '/page-details/:param1',
  templateUrl: 'templates/title_detail.html',
  controller:  'pageDetailsController',
  params: {item: null}

I have JSON which I’m supposed to map with the above states. The JSON looks something like this. There can be only two states, pageshow and titledetail. How can I set-up the URLs for states such that the folder type objects map to pageshow and page type objects map to titledetail.
It’s like folder within a folder with some pages and other folders where other folders have pages and/or folders too. When a folder is clicked the URL is matched to the pageshow state adn when a page is clicked the URL is matched with titledetail state. Example folder URLs:

  1. /dashboard/ (All the content)
  2. /dashboard/{id}/
  3. /dashboard/{id}/{id}/
  4. /dashboard/{id}/{id}/{id}/{id}/

Any help is appreciated