angularjs implements Form form submission information login. After clicking "Login", use state.go to jump to transfer data. How to accept the data after the jump?
//Code to implement jump
$state.go('landing_page',{'phone':$scope.phone,'validCode':$scope.validCode});
The phone and validCode here are the data I need to pass.
ps: Is the form submission page jump implemented in this way? Or is it better to use location?
1. It is possible to transfer data in this way, but there will be some minor problems. If you enter the
landing_page
status page that jumps, if you refresh this page, then the parameters you passed with the route (except route parameters) It will be gone, which is more embarrassing; so a good suggestion is to process the data you need before jumping to the route.2. If these parameters are
路由参数
, then the above problems will not occur, and the routing parameters will always be saved in the route.3. If the parameters you pass with the route are also needed on the page after the jump, then you need to get them again before entering this page. You can try to use the
ui-router
插件的resolve
method to get some of the data you need, and then inject it into the corresponding in the controller.