作者:L鸿玖 | 来源:互联网 | 2023-09-24 09:24
router,pleasereferbelowrouterconfiginapp.js路由器,请参考以下app.js中的路由器配置$stateProvider.state(
router, please refer below router config in app.js
路由器,请参考以下app.js中的路由器配置
$stateProvider
.state('mySite', {
abstract: true,
templateUrl: 'mySite.tpl.html',
controller: 'mySiteController',
controllerAs: 'mySiteApp'
});
$urlRouterProvider.otherwise(function ($injector, $location) {
if ($location.url() === '' || $location.url() === '/'){
$location.$$search = {};
return '/home';
}
else {
return '/404';
}
In above web a user can come with a parameter in url, example lets say a user visits to site with www.mysite.com?par=xxx , then i handle the par within app.js. and i need to remove parameters before it route to child state. For example: www.mysite.com/home instead of www.mysite.com?par=xxx/home please note $location.$$search = {}; used above didn't worked as expected in this case. Please help me...
在上面的网站中,用户可以在网址中附带参数,例如,假设用户使用www.mysite.com?par=xxx访问网站,然后我在app.js中处理par。我需要在路由到子状态之前删除参数。例如:www.mysite.com/home而不是www.mysite.com?par=xxx/home请注意$ location. $$ search = {};在这种情况下,上面使用的没有按预期工作。请帮我...
1 个解决方案