First, you need to have configured your rout, for example:

.state ("firstpage", {
.state ("secpage", {params:{"message":null},url:"/page/secpage",templateurl:"page/views/secpage.html",controller:"secpagectrl"

Note the params attribute in the second address information, this is the object i want to accept parameters,Defined as key:value

When jumping to a page,Both methods can pass parameters,One is written directly in the html

<a ui-sref="sec-page">Jump to the second page</a>

At this point, the passing parameter follows the page address

<a ui-sref="sec-page ({message:messageid})">Jump to the second page</a>

The second 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 objects

.controller ("firstpagectrl", function ($scope, $state) {
State $state.go ("secpage", {message:messageid});

Pass the parametersYou need to receive it with $stateparams in the controller of the target page. To change the method, you need to inject it in advance

.controller ("secpagectrl", function ($scope, $state, $stateparams) {
Var test=$stateparams.message;
  • Previous jQuery ajax and traversing array json instance code
  • Next Custom Properties of Android Custom Controls (2)