简体   繁体   English

AngularJS UI路由器状态不起作用

[英]AngularJS ui-router state not working

I cant access pages when I use this state name item.info:( But when I make state name like itemInfo(not item.info) it all works fine. How can It be fixed and what`s the problem? UPD: No error showing. Only url change without any action. Not working: 当我使用状态名称item.info时,我无法访问页面:(但是当我将状态名称设为itemInfo(not item.info)时,它都可以正常工作。如何解决该问题,这是什么问题?UPD:无错误显示。仅URL更改,没有任何操作。不起作用:

.state('item', {
    url: '/items',
    template: '<items></items>',
}).state('item.info', {
    url: '/:itemId',
    template: '<item-info></item-info>',
    params: {
        itemId: null
    }
})

Working: 工作方式:

.state('item', {
  url: '/items',
  template: '<items></items>',
}).state('itemInfo', {
  url: '/item/:itemId',
  template: '<item-info></item-info>',
  params: {
    itemId: null
  }
})

Try this: 尝试这个:

 .state('item', {
    url: '/items',
    template: '<items></items>',
 })

 .state('item.info', {
    url: '^/:itemId',
    template: '<item-info></item-info>',
    params: {
      itemId: null
 }
})

source: https://github.com/angular-ui/ui-router/wiki/URL-Routing 来源: https : //github.com/angular-ui/ui-router/wiki/URL-Routing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM