0

无法story.detail?storyId=167&pubId=84从状态解析search

var params = 'storyId='+$scope.stories[index].ID+'&pubId='+$scope.pubId;
$state.go('story.detail?'+params);

$stateProvider
    .state('story.list', {
        url: '/search?storyId&pubId',
        templateUrl: 'views/search.html',
        controller: 'SearchCtrl',
        resolve: {
            ds : ['$wakanda', function($wakanda){
                    return $wakanda.init();
                }]
        }
    })
    .state('story', {
        url: '/story',
        abstract: true,
        templateUrl: 'views/story.html'
        // controller: 'StoryCtrl'
    })
    .state('story.detail', {
        url: '/story.detail?storyId&pubId',
        templateUrl: 'views/story_detail.html',
        controller: 'StoryDetailCtrl',
        resolve: {
            ds : ['$wakanda', function($wakanda){
                return $wakanda.init();
          }]
        }
    });

我在这里阅读了其他类似的问题和回复。

我不知道为什么路由器无法story.detail?storyId=167&pubId=84从 state解析状态名称search

4

1 回答 1

1

$state.go应该像这样配置:

$state.go('story.detail', {
    storyId : $scope.stories[index].ID,
    pubId : $scope.pubId  
 });
于 2015-07-07T03:35:54.117 回答