Angularjs $stateParams查询参数未定义

Angularjs $stateParams查询参数未定义,angularjs,angular-ui-router,angular-ui,Angularjs,Angular Ui Router,Angular Ui,我正在尝试从我的angular UI路由器应用程序获取查询参数。然而,当我使用查询方法时,我似乎无法获得它们。状态参数始终是未定义的 $stateProvider.state("message", { views: { "main-view": { templateUrl: "admin/templates/message.html", controller: ["$scope", "$stateParams", funct

我正在尝试从我的angular UI路由器应用程序获取查询参数。然而,当我使用查询方法时,我似乎无法获得它们。状态参数始终是未定义的

$stateProvider.state("message",
{
    views: {
        "main-view": {
            templateUrl: "admin/templates/message.html",
            controller: ["$scope", "$stateParams", function ($scope, $stateParams )
            {
                // Get the params
                $scope.message = $stateParams.message; // undefined
                $scope.error = $stateParams.status; // undefined
            }]
            }
        },                  
        url: "/admin/message?message&status"
     })
}
我用于访问此状态的URL为:

http://localhost:8080/admin/message?message=hello&status=error
但是,如果我使用基本参数方法,它工作得很好。即:

url: "/admin/message/:message/:status"
...
http://localhost:8080/admin/message/hello/error
我激活了html5模式(不确定这是否会影响它?)

我的代码已经针对上述内容进行了简化-我在这里做错了什么吗?我忘了带什么东西了吗


谢谢

您在哪里看到过
url:“/admin/message?message&status”
可以这样定义?我只知道另一种方法对你有效。为什么不使用它呢?嗨,Omri-从网站上看,它说你可以像我那样做:我需要使用查询参数,因为我使用的是第三方系统,它使用我无法更改的查询字符串发送数据