Issue 1:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When loading an application using a leading slash and query parameters, the route matcher misbehaves:

For the following routes:

a
a/:userName

Requesting 'site.com/a' and ''site.com/a/' both return the correct route a

Requesting 'site.com/a?someParam=1' returns the correct route a

Requesting 'site.com/a/?someParam=1' returns the route a/:userName

This is an edge case, as [routerLink] elements handle this correctly, and it is only when loading routes directly that the problem is observed

Expected behavior

Requesting 'site.com/a/?someParam=1' should return the route a, the query parameters shouldn't influence route matching

Minimal reproduction of the problem with instructions

Demo isn't possible through plunkr as direct links are not testable

Create an app with the routes defined above, and load the links directly (this only manifests itself on first loads)

EDIT: simplest way to reproduce:

Clone https://github.com/angular/angular2-seed

Running:

load http://localhost:3000/#/home and http://localhost:3000/#/home/, verify both work

load http://localhost:3000/#/home/?test=1, verify a "Cannot match any routes." error is thrown

What is the motivation / use case for changing the behavior?

This was found when creating email links to account verification. It is an edge case as specified above, but still possible and may have other implications I haven't considered

Please tell us about your environment:

Tested using Typescript + WebPack

Angular version: 2.2.X

Browser: Tested on Chrome 54.0.2840.98

Language: TypeScript

Issue 2:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Query string being is being treated as a path segment for route matching

RouterModule.forRoot([
{ path: 'items/all', component: AllItemsComponent }
{ path: 'items/:id/:alias', component: SingleItemComponent }
]);

Navigating to /items/all?param=x shows AllItemsComponent

Navigating to /items/all/?param=x shows SingleItemComponent

Navigating to /items/all/ redirects to /items/all

Expected/desired behavior

Navigating to /items/all?param=x shows AllItemsComponent

Navigating to /items/all/?param=x shows AllItemsComponent or redirects to /items/all?param=x

It would be nice if we could provide a regex for matching routes, rather than just a simple path. This could be solved in the back-end but that is very annoying to have to do.

Reproduction of the problem

See above - sorry I don't know how to demonstrate this using plnkr since it requires navigating directly to a page.

What is the expected behavior?

See above

What is the motivation / use case for changing the behavior?

If /path/ behaves the same as /path, then /path/?query should behave the same as /path?query

Please tell us about your environment:

Angular version: 2.0.0-rc.5

Browser: all

Language: TypeScript 1.8