Skip to content

Commit

Permalink
refactor($state): simplify include()
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Mar 25, 2014
1 parent 34207b1 commit 0da45a1
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -1043,29 +1043,20 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {

$state.includes = function includes(stateOrName, params) {
if (isString(stateOrName) && isGlob(stateOrName)) {
if (doesStateMatchGlob(stateOrName)) {
stateOrName = $state.$current.name;
} else {
if (!doesStateMatchGlob(stateOrName)) {
return false;
}
stateOrName = $state.$current.name;
}

var state = findState(stateOrName);

if (!isDefined(state)) {
return undefined;
}

if (!isDefined($state.$current.includes[state.name])) {
return false;
}

var validParams = true;
angular.forEach(params, function(value, key) {
if (!isDefined($stateParams[key]) || $stateParams[key] !== value) {
validParams = false;
}
});
return validParams;
return equalForKeys(params, $stateParams);
};


Expand Down

1 comment on commit 0da45a1

@nateabele
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dferretti If I recall correctly, the change was intentional. It'll make more sense once full parameter typing support is out.

Please sign in to comment.