是否可以合并原始网址中的查询字符串?
所以我有这个index.html与ngRoute
路由,如下所示:
function($routeProvider) {
$routeProvider
.otherwise(
redirectTo: '/login'
)
}
我想要做的是合并以下网址
index.html?toke=1234567
到
index.html#/login?token=1234567
答案 0 :(得分:0)
.run(["$rootScope", "$location", function($rootScope, $location){
$rootScope.path = {
key: 'token',
redirect: function(path, params) {
var queryParams = {};
queryParams[this.key] = Date.now();
queryParams["device"] = $location.search().device;
var location = $location.path(path).search(queryParams);
}
};