Skip to content

Commit

Permalink
fix(ng1.stateService): Coerce 'null' params value to empty object
Browse files Browse the repository at this point in the history
Closes #2952
  • Loading branch information
christopherthielen committed Aug 31, 2016
1 parent 874fc07 commit f674151
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/state/stateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,19 +460,20 @@ 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,
absolute: false,
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 = <any> this.params.$inherit(params || {}, this.$current, state);
if (options.inherit) params = <any> this.params.$inherit(params, this.$current, state);

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

Expand Down

0 comments on commit f674151

Please sign in to comment.