X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/angular2/src/router/url_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function serializeParams(paramMap: {[key: string]: any}): string[] {
var params = [];
if (isPresent(paramMap)) {
StringMapWrapper.forEach(paramMap, (value, key) => {
if (value == true) {
if (value === true) {
params.push(key);
} else {
params.push(key + '=' + value);
Expand Down
9 changes: 9 additions & 0 deletions modules/angular2/test/router/router_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ export function main() {
expect(path).toEqual('hi/how/are/you?name=brad');
});

it('should preserve the number 1 as a query string value', () => {
router.config(
[new Route({path: '/hi/how/are/you', component: DummyComponent, name: 'GreetingUrl'})]);

var instruction = router.generate(['/GreetingUrl', {'name': 1}]);
var path = stringifyInstruction(instruction);
expect(path).toEqual('hi/how/are/you?name=1');
});

it('should serialize parameters that are not part of the route definition as query string params',
() => {
router.config([
Expand Down
X Tutup