Last forwarded about Angularjs fallback article, back to use or JS fallback function, directly with history.back (); Implementation function, at that time, by the way $state.go () about the routing jump. This time, the full analysis of the $state.go (), the function.
Here are the shorthand steps:
1. Parameters accepted on the target page: $stateProvider. State (' Page2 ', {params: {' data ': null}}); 2. Reference:$state. Go(' Page2 ', {data: ' AAA '}); 3. The target page accepts the parameter: after the controller injects $stateparams can obtain ' AAA ' through the $stateparams.data;
1. The difference between ui-sref, $state. Go
ui-sref
Generally used in<a>...</a>;
<Ui-sref= "Message-list"> Message Center </a>
$state.go(‘someState‘)
Generally used in the controller inside;
function($scope, $state) { $state. Go (' login '); });
These two are essentially the same thing, we look at the source code of UI-SREF:
function(e) { var button = E.which | | E.button; if (! ( button > 1 | | E.ctrlkey | | E.metakey | | E.shiftkey | | Element.attr (' target 'var transition = $timeout (function//Here we call $state. Go inside of ui-sref< c14> $state. Go (ref.state, params, options); });
Ui-sref Last Call or $state.go () method
2. How to pass parameters
First, you define the accepted parameters on the target page:
Reference, Ui-sref:
$state. Go:
Receive parameters,
Inject $stateparams into the controller of the target page, and then "$stateParams. Parameter name" gets
Article turned from: http://www.cnblogs.com/jager/p/5293225.html
On the $state.go () and ui-sref parameters of Angularjs