简体   繁体   English

不能使用AngularJS 1中的routeProvider中的查询参数进行路由

[英]Not able to route with Query Parameters in routeProvider with AngularJS 1

I was developing a project with AngularJS 1 as my frontend fw, and until and unless I did not utilized the routeProvider to make it an SPA, everything was working fine. 我当时正在使用AngularJS 1作为前端程序来开发一个项目,直到并且除非我没有使用routeProvider使其成为SPA,否则一切都会正常进行。 But now I am not able to route to my specifically created route. 但是现在我无法转到我专门创建的路线。

To add more to the problem, I have this URL for instance 为了进一步解决这个问题,我有这个网址

http://www.myblog.com/d?llh=12343434

If you notice the last part of the URL, the "llh" variable, it is a security measured imposed to check the session activity by the URL.(But that is purely backend, and it works fine) 如果您注意到URL的最后一部分,即“ llh”变量,则该安全性是通过URL检查会话活动的一种安全措施。(但这纯粹是后端,并且可以正常工作)

.config(['$routeProvider','$httpProvider','$locationProvider','base_url',function($routeProvider, $httpProvider, $locationProvider,base_url){
            $routeProvider
            .when("/d/:llh", {
                template: "<h4>Hello World</h4>",
                controller: "manageDistributions"
            })
            $locationProvider.html5Mode(true);
        }])

It worked with defining the route as 它通过将路线定义为

在此处输入图片说明

instead of 代替 在此处输入图片说明

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

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