首页 > 解决方案 > 在 state 方法中隐藏变量值

问题描述

使用的代码:

/*Main from other page with URL*/
      .state("main/handler/location/userSso",{
             url:"/main/handler/:location/:",
             templateUrl:"component/common/main.html",
             controller: 'MainController'
    })

从一个模块到另一个模块:https ://example.com/#/main/handler/comp/99999300 必需:https ://example.com/#/main/handler/comp/

不想在 URL 中传递 UserID。

.state("main/handler/location/userSso"  : users

所以应该从视图中隐藏。

标签: phpangularjsangularmicroservices

解决方案


要在 url 中隐藏值,您必须在params 没有squash

$stateProvider
  .state("main/handler/location/userSso",{
   url:"/main/handler?location?userId",
   templateUrl:"component/common/main.html", 
    controller: 'MainController',
    resolve: {},
    params: {
      location: {
        value: null 
       }
      userId: {
        value: null
      }
    }
  })

推荐阅读