Skip to content

Commit 7c16af5

Browse files
committed
feat(state): get any property of any state
Example: ```javascript var url = $state.getOptionOfState('url', 'myStateName') ```
1 parent 0f5c86c commit 7c16af5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/state.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
222222
exiting = fromPath[l];
223223
if (exiting.self.onExit) {
224224
$injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);
225-
}
225+
}
226226
exiting.locals = null;
227227
}
228228

@@ -279,6 +279,11 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
279279
return !$locationProvider.html5Mode() && url ? "#" + url : url;
280280
};
281281

282+
$state.getOptionOfState = function (option, stateOrName) {
283+
var state = findState(stateOrName);
284+
return state.self[option];
285+
};
286+
282287
function resolveState(state, params, paramsAreFiltered, inherited, dst) {
283288
// We need to track all the promises generated during the resolution process.
284289
// The first of these is for the fully resolved parent locals.

0 commit comments

Comments
 (0)