Skip to content

Commit

Permalink
fix(UrlMatcher): query param function defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Apr 20, 2014
1 parent ed844c6 commit f9c2053
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/urlMatcherFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ UrlMatcher.prototype.exec = function (path, searchParams) {
for (/**/; i < nTotal; i++) {
param = params[i];
cfg = this.params[param];
values[param] = isDefined(searchParams[param]) ? cfg.type.decode(searchParams[param]) : cfg.value;
values[param] = cfg.$value(searchParams[param]);
}

return values;
Expand Down
9 changes: 9 additions & 0 deletions test/urlMatcherFactorySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,15 @@ describe("urlMatcherFactory", function () {
}
});
expect(m.exec('/foo').bar).toBe("Value from bar()");

var m = new UrlMatcher('/foo?bar', {
params: {
bar: function() {
return "Value from bar()";
}
}
});
expect(m.exec('/foo').bar).toBe("Value from bar()");
});

it("should allow injectable functions", inject(function($stateParams) {
Expand Down

0 comments on commit f9c2053

Please sign in to comment.