Skip to content

Commit 4423093

Browse files
committed
feat(state): get options for state
Example: ```javascript var options = $state.getOptionsOfState('myStateName'); var url = options.url; ```
1 parent 0f5c86c commit 4423093

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/state.js

Lines changed: 6 additions & 1 deletion
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.getOptionsOfState = function (stateOrName) {
283+
var state = findState(stateOrName);
284+
return angular.copy(state.self);
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)