Skip to content

Commit bf38b0d

Browse files
committed
$state.getConfig() now returns the actual state configuration object.
1 parent 81f19da commit bf38b0d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/state.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
278278

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

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

test/stateSpec.js

+3-1
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)