AngularJS ui-router, how to get the name of the targeted state in the resolve object of an abstract partent state? -



AngularJS ui-router, how to get the name of the targeted state in the resolve object of an abstract partent state? -

i using ui-router , have kid states , abstract 1 - parent.

now, want able user role management , want in single place, roots.

the best way it, in parent's state resolve object.$stateprovider

here, mange app width authentication data.

the question is, how targeted state resolve function of abstract state?

.state('section', { abstract: true, template: '<ui-view/>', resolve: { // auth & role management middleware. userdata: ['$q', '$stateparams', 'session', function ($q, $stateparams, session) { // how destination route here. $state.current.name - returns null $stateparams - empty object. // ideas? var userdata; userdata = session.getuserdata(); if (userdata.token) { homecoming userdata; } homecoming $q.reject('login'); }] } });

state hasn't updated when within resolve.

my workaround far hear '$statechangestart' event by

$rootscope.$on('$statechangestart', callback)

this event emitted before resolve, , sec param passed callback tostate has info need.

you can set logic session service

angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -