Use a parameter in URL for certain states at the beginning of it

0

I am using angular router to work on my site. Right now a requirement of the system is to maintain an element that is crucial for the site in the URL but to be a semantic URL, I need that element to be at the beginning of the whole URL, long before defining the URL of the state.

Right now my states look like this:

'secure': {
    name: 'Secure',
    url: '/secure',
    abstract: true,
    views: {
      // the main template will be placed here (relatively named)
      '@': {
        templateUrl: './views/common/layout.html'
      },
      'header@secure': {
        templateUrl: './views/common/header.html'
      },
      'navigation@secure': {
        templateUrl: './views/common/navigation.html'
      },
      'footer@secure': {
        templateUrl: './views/common/footer.html'
      }
    }
  },
  'secure.manageFeatures': {
    'name': 'manageFeatures',
    'url': '/manageFeatures',
    'templateUrl': './views/manageFeatures.html',
    'data': {
      'pageTitle': 'manageFeatures'
    }
  },
  'secure.technicalConfiguration': {
    name: 'configuration',
    url: '/configuration',
    templateUrl: './views/technicalConfiguration.html',
    controller: 'secTechnicalConfigurationCtrl',
    data: {
      pageTitle: 'Configuration'
    }
  }

And the url looks like this:

link link

I need to make the URLs have one more parameter at the beginning and not in all the URLs.

For example:

link link

I tried using the same documentation offered and placing the param at the end of the URL

url: '/configuration/:idCuenta'

It works perfect, but doing it on the contrary does not work correctly, since it would have to modify the parent state of all "secure" and could not control when you need the id and when not to use it.

In angular I have already worked a long time but I am new using a router. I appreciate not being too strict with my questions.

    
asked by GunBlade 22.09.2016 в 23:32
source

0 answers