First, you need to have your rout configured, such as:
$stateProvider
. State (' FirstPage ', {
URL: '/page/firstpage ',
templateurl: ' page/views/firstpage.html ') ,
controller: ' Firstpagectrl '
//dependencies: [' Service/vipseachservice ']
})
. State (' Secpage ', {p arams:{' message ': null},
URL: '/page/secpage ',
templateurl: ' page/views/secpage.html ',
controller: ' Secpagectrl '
})
Note the params attribute in the second address message, which is the object you want to accept the parameter to, defined in key:value form.
In the jump page, two methods can be passed, one is written directly in the HTML
<a ui-sref= "Sec-page" > Jump second page </a>
At this point, the argument follows the page address.
<a ui-sref= "Sec-page ({Message:messageid})" > Jump second page </a>
The second is written in controller.
. Controller (' Firstpagectrl ', function ($scope, $state) {
$state. Go (' secpage ');});
The same parameters are written at the end of the address, in the form of an object
. Controller (' Firstpagectrl ', function ($scope, $state) {
$state. Go (' Secpage ', {message:messageid});
});
Pass the parameters of the past, need to be in the target page of the controller in the $stateparams receive, the change method needs to be injected in advance
. Controller (' Secpagectrl ', function ($scope, $state, $stateParams) {
var test= $stateParams. Message;
});
The above is a small set to introduce the angular page jump newsletters The question, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!