ui-router root url重定向到空URL

时间:2018-01-09 13:09:20

标签: angularjs angular-ui-router

我有一个父状态,其中url被映射为'/',当我访问root时,例如:http://localhost:8081/sin/TPW/,它将我重定向到具有空url的子状态。

我不知道它为什么选择这个子状态,因为还有其他子状态也有空URL,并且它们没有被调用。

被调用的状态是 parent.foto3

        $locationProvider.html5Mode(true);
        $locationProvider.hashPrefix('!');

        $stateProvider
            .state('parent', {
                url: '/',
                views: {
                    '$default': {
                        component: 'parent'
                    }
                }
            })

            .state('parent.token', {
                url:'open?k',
                views: buildViews('tokenless', false, true),
            })

            .state('parent.confirmacao', {
                url: '',
                params: {aviso: {dynamic: true}},
                views: buildViews('confirmacao', true),
            })

            .state('parent.cancelada', {
                url: '',
                views: buildViews('cancelada'),
            })

            .state('parent.foto1', {
                url: '',
                views: buildViews('foto1', true),
            })

            .state('parent.foto2', {
                url: '',
                views: buildViews('foto2', true),
            })

            .state('parent.foto3', {
                url: '',
                views: buildViews('foto3', true),
            })

            .state('parent.foto4', {
                url: '',
                views: buildViews('foto4', true),
            })

            .state('parent.foto5', {
                url: '',
                views: buildViews('foto5', true),
            })

            .state('parent.foto6', {
                url: '',
                views: buildViews('foto6', true),
            })

            .state('parent.concluido', {
                url: '',
                views: buildViews('concluido'),
            })

            .state('parent.erro', {
            url: 'err',
                params: {erro: {dynamic: true}},
                views: buildViews('erro'),
            });

        $urlRouterProvider.otherwise('err');

Angular:1.6 ui-router:1.0.3

1 个答案:

答案 0 :(得分:0)

我有噪音跟随事物

  • 如果新州名以&#34开头,则为父母"所以它将自动设置父状态父
  • 每个州都必须有唯一的州名和网址模板

enter image description here

相关问题