Skip to content

Commit

Permalink
fix(StateService): Compare typed parameters in .is() and .includes()
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Nov 30, 2016
1 parent d49ca1d commit b1a5155
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/state/stateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ export class StateService {
let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);
if (!isDefined(state)) return undefined;
if (this.$current !== state) return false;
return isDefined(params) && params !== null ? Param.equals(state.parameters(), this.params, params) : true;
if (!params) return true;

let schema: Param[] = state.parameters({ inherit: true }).filter(param => params.hasOwnProperty(param.id));
return Param.equals(schema, Param.values(schema, params), this.params);
};

/**
Expand Down Expand Up @@ -463,8 +466,10 @@ export class StateService {

if (!isDefined(state)) return undefined;
if (!isDefined(include[state.name])) return false;
// @TODO Replace with Param.equals() ?
return params ? equalForKeys(Param.values(state.parameters(), params), this.params, Object.keys(params)) : true;
if (!params) return true;

let schema: Param[] = state.parameters({ inherit: true }).filter(param => params.hasOwnProperty(param.id));
return Param.equals(schema, Param.values(schema, params), this.params);
};


Expand Down

0 comments on commit b1a5155

Please sign in to comment.