First, you need to have configured your router, for example:
$stateProvider.state('firstPage',{url:'/Page/firstPage',templateUrl: 'Page/views/firstPage.html',controller: 'firstPageCtrl'//dependencies: ['service/vipSeachService']}).state('secPage', { params:{'message':null},url: '/Page/secPage',templateUrl: 'Page/views/secPage.html',controller: 'secPageCtrl'})Pay attention to the params attribute in the second address information, which is the object you want to accept parameters, defined in the form of key:value
When jumping to the page, both methods can be passed through parameters. One is to write it directly in the html
<a ui-sref="sec-page">Jump on the second page</a>
At this time, the transfer is followed by the page address
<a ui-sref="sec-page({message:messageId})">Jump the second page</a>The second type is written in the controller
.controller('firstPageCtrl', function($scope, $state) { $state.go('secPage'); });The same parameters are written after the address, in the form of an object
.controller('firstPageCtrl', function($scope, $state) { $state.go('secPage', {message:messageId}); });The passed parameters need to be received using $stateParams in the controller of the target page. The method needs to be injected in advance.
.controller('secPageCtrl', function($scope, $state,$stateParams) { var test=$stateParams.message;});The above is the Angular page transfer issue introduced by the editor to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!