Skip to content

Commit f674151

Browse files
fix(ng1.stateService): Coerce 'null' params value to empty object
Closes #2952
1 parent 874fc07 commit f674151

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/state/stateService.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -460,19 +460,20 @@ export class StateService {
460460
*
461461
* @returns {string} compiled state url
462462
*/
463-
href(stateOrName: StateOrName, params?: RawParams, options?: HrefOptions): string {
463+
href(stateOrName: StateOrName, params: RawParams, options?: HrefOptions): string {
464464
let defaultHrefOpts = {
465465
lossy: true,
466466
inherit: true,
467467
absolute: false,
468468
relative: this.$current
469469
};
470470
options = defaults(options, defaultHrefOpts);
471+
params = params || {};
471472

472473
let state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);
473474

474475
if (!isDefined(state)) return null;
475-
if (options.inherit) params = <any> this.params.$inherit(params || {}, this.$current, state);
476+
if (options.inherit) params = <any> this.params.$inherit(params, this.$current, state);
476477

477478
let nav = (state && options.lossy) ? state.navigable : state;
478479

0 commit comments

Comments
 (0)