1 Ui-sref, $state. The difference between go
ui-sref
Generally used in<a>...</a>;
<a ui-sref= "message-list" > Message Center </a>
$state.go(‘someState‘)
Generally used in the controller inside;
. Controller (' Firstctrl ', function ($scope, $state) { $state. Go (' login ');});
These two are essentially the same thing, we look at the source code of UI-SREF:
... element.bind ("click", 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
$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:
Pass the argument,
Ui-sref:
$state. Go:
Receive parameters,
Inject $stateparams into the controller of the target page, and then "$stateParams. Parameter name" gets
In Angularjs Ui-sref and $state. Go how to pass parameters