Skip to content

Commit e1136b3

Browse files
committed
Switch to an empty $state.get() as the API (as per angular-ui#411).
1 parent 4ac2edb commit e1136b3

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/state.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,15 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory, $
344344
};
345345

346346
$state.get = function (stateOrName) {
347+
if (!isDefined(stateOrName)) {
348+
var list = [];
349+
forEach(states, function(state) { list.push(state.self); });
350+
return list;
351+
}
347352
var state = findState(stateOrName);
348353
return (state && state.self) ? state.self : null;
349354
};
350355

351-
$state.getAll = function () {
352-
var list = [];
353-
forEach(states, function(state) { list.push(state.self); });
354-
return list;
355-
};
356-
357356
function resolveState(state, params, paramsAreFiltered, inherited, dst) {
358357
// Make a restricted $stateParams with only the parameters that apply to this state if
359358
// necessary. In addition to being available to the controller and onEnter/onExit callbacks,

test/stateSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ describe('state', function () {
395395
}));
396396

397397
it("should return all of the state's config", inject(function ($state) {
398-
var list = $state.getAll().sort(function(a, b) { return (a.name > b.name) - (b.name > a.name); });
398+
var list = $state.get().sort(function(a, b) { return (a.name > b.name) - (b.name > a.name); });
399399
var names = [
400400
'', // implicit root state
401401
'A',

0 commit comments

Comments
 (0)