Skip to content

Losing my lang-locale from the url on state.go #3088

@jrmcdona

Description

@jrmcdona

I am injectin lang-locale (ie. "en-GB") into my URL.

I have this abstract route in my App.js config that has a url param for the lang-locale. When I run state.go('app.index') I am losing my lang-locale.

Such as this sequence here:

  1. www.mysite.com/en-us
  2. state.go hits
  3. I end up here www.mysite.com
$stateProvider.state('app', {
                abstract: true,
                url: '/{lang:(?:en-US)}',
                template: '<ui-view=main/>'
            })

Then in my home module I have a child state set up.

$stateProvider.state('app.index', {
            url: '',
            views: {
                "main": {
                    controller: 'homeController',
                    templateUrl: '/Scripts/app/home/views/home.html'
                }
            },
            resolve: {},
            data: {
                pageTitle: ''
            }
        })

$state.go('app.index') is my app.js run method.

I am trying to follow this article https://fadeit.dk/blog/2015/03/30/angular-translate-ui-router-seo/ but he doesn't seem to have this issue that I see.

Any help would be great while I keeping digging at it.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions