From f6741516a43a605ed7f8f3d1d96517e7e46ef54d Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Wed, 31 Aug 2016 01:42:56 -0500 Subject: [PATCH] fix(ng1.stateService): Coerce 'null' `params` value to empty object Closes #2952 --- src/state/stateService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/state/stateService.ts b/src/state/stateService.ts index 7eed7d5e7..811f1be92 100644 --- a/src/state/stateService.ts +++ b/src/state/stateService.ts @@ -460,7 +460,7 @@ export class StateService { * * @returns {string} compiled state url */ - href(stateOrName: StateOrName, params?: RawParams, options?: HrefOptions): string { + href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string { let defaultHrefOpts = { lossy: true, inherit: true, @@ -468,11 +468,12 @@ export class StateService { relative: this.$current }; options = defaults(options, defaultHrefOpts); + params = params || {}; let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); if (!isDefined(state)) return null; - if (options.inherit) params = this.params.$inherit(params || {}, this.$current, state); + if (options.inherit) params = this.params.$inherit(params, this.$current, state); let nav = (state && options.lossy) ? state.navigable : state;