angularjs - ui-router ignoring state params -


i'm trying implement forgot password flow in application collects information user , passes through states.

after user submits employee id , want reset code sent (email or phone), send both of token state:

$state.go("^.token", { employeeid: forgot.employeeid, resettype: forgot.resettype }); 

my router pretty straightforward:

$stateprovider.state("authentication.forgot", {   url: "/login/forgot",   templateurl: "partials/authentication/forgot.html",   controller: "forgotcontroller forgot",   onenter: function () { $(document).foundation(); } });  $stateprovider.state("authentication.token", {   url: "/login/token",   templateurl: "partials/authentication/token.html",   controller: "tokencontroller token",   onenter: function () { $(document).foundation(); } }); 

and here token controller:

app.controller("tokencontroller", function ($state, $stateparams, $timeout, authentication) {   console.log($stateparams); }); 

in token controller, $stateparams ends being empty object.

you not specifying parameter in $stateprovider definition, put url parameter or define params parameter in $stateprovider definition.

url: "/login/token", params: {   object: {}    }, templateurl: "partials/authentication/token.html", 

note {} default value object, in case no params specified in state transition, , you'll able access via $sateparams.object


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -