I'm working with angularjs and UI-Router. I'd like to configure routes which specify the selected language. though this part of the route should be optional.
I have following states:
{
    state: 'app',
    config: {
          abstract: true,
          url: '/{lang:(?:de|en)}',
          template: '<ui-view/>'
    }
}
{
    state: 'app.mainview',
    config: {
          url: '/mainview',
          templateUrl: 'app/mainview/mainview.html',
          controller: 'MainviewController',
          controllerAs: 'vm',
          title: 'Main View',
          settings: {
              pos: 1,
              displayName: 'Mainview',
              icon: 'code-array'
          }
    }
}
now its only possible to navigate to mainview with
example.com/en/mainview
Though I'd like to configure the ui-router so that all o the following routes are valid:
example.com/mainview
example.com/en/mainview
example.com/de/mainview
Can I set a route with an optional language param at the beginning without using a double slash? If no, what alternatives do you suggest?
 
     
    