The first:
The parameter will appear in the access address in the form of ?:userId will automatically become ?userId=0010001
$stateProvider.state('page.home', { url:"/home?:userId", templateUrl: "/html/homeView", controller: "homeController", title:"首页", params:{userId:null} })
The second:
The parameters appear directly inside the url and will be automatically converted to http://localhost/user/0010001/detail
$stateProvider.state('page.home', { url:"/user/:userId/detail", templateUrl: "/html/userDetailView", controller: "userDetailController", title:"会员详情", params:{userId:null} })
The third:
Parameters do not appear in the address bar to hide incoming
$stateProvider.state('page.home', { url:"/user/detail", templateUrl: "/html/userDetailView", controller: "userDetailController", title:"会员详情", params:{userId:null} })
The above three methods of uploading parameters all use the following method to jump
$state.go("page.home",{userId:"0010001"});
If it is ui-sref , it is written like this ui-sref="page.home({userId:'0010001'})", if it is inside the ng-repeat loop, it can be written like this,
<a ng-repeat="item in userList" ui-sref="page.home({userId:item.userId})" ng-bind="item.name"></a>
it's the same when you get it
$ stateParams.userId