angularjs - Angular UI Router - onEnter not get the $stateParams -
according faq code should work:
$stateprovider.state("items.add", { url: "/add", onenter: ['$stateparams', '$state', '$modal', '$resource', function($stateparams, $state, $modal, $resource) { console.log($stateparams.param1); // should print "bla bla bla" $stateparams.param1 isnot defined; }], url: "/test", onenter: ['$state', function($state){ $state.go('add', {param1: 'bla bla bla'}); } });
and should print "bla bla bla"..
can tell me why not working?
this code has multiple syntax errors , don't see how could've run (missing ]
, duplicate properties in same object, etc).
my best guess haven't defined param1
parameter. can't utilize arbitrary parameters when transitioning state, must either part of url or defined in params
state argument.
angularjs angular-ui angular-ui-router
No comments:
Post a Comment