Skip to content

Commit c2bfa83

Browse files
committed
$state.getConfig() now returns the actual state configuration object.
1 parent fb3e027 commit c2bfa83

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
281281

282282
$state.getConfig = function (stateOrName) {
283283
var state = findState(stateOrName);
284-
return state.self ? angular.copy(state.self) : null;
284+
return state.self || null;
285285
};
286286

287287
function resolveState(state, params, paramsAreFiltered, inherited, dst) {

test/stateSpec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ describe('state', function () {
288288
});
289289

290290
describe('.getConfig()', function () {
291-
it("should return a copy of the state's config", inject(function ($state) {
291+
it("should return the state's config", inject(function ($state) {
292292
expect($state.getConfig('home').url).toBe('/');
293293
expect($state.getConfig('home.item').url).toBe('front/:id');
294+
expect($state.getConfig('A')).toBe(A);
295+
expect(function() { $state.getConfig('Z'); }).toThrow("No such state 'Z'");
294296
}));
295297
});
296298

0 commit comments

Comments
 (0)