From b1a51550508498f26ec5aa3013c885682112f1bb Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Tue, 29 Nov 2016 19:08:00 -0600 Subject: [PATCH] fix(StateService): Compare typed parameters in .is() and .includes() Closes https://github.com/angular-ui/ui-router/issues/3154 --- src/state/stateService.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/state/stateService.ts b/src/state/stateService.ts index 395e3a08..2f840569 100644 --- a/src/state/stateService.ts +++ b/src/state/stateService.ts @@ -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); }; /** @@ -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); };