improve interpolation of params in ngRoute

Request Type: bug

How to reproduce: 6f776102b23f413f7f2443ef

1. create a route with optional parameters, eg. $routeProvider.when('/profile/:userId?', ...)

2. angular will add the automatic redirect with or without the trailing /, in this case '/profile/userId?/'

3. point your browser to the redirect http://localhost/#!/profile/0/, you'll see the encoded ? (%3F) at the end of the url: http://localhost/#!/profile/0%3F

Component(s): ngRoute

Impact: medium

Complexity: small

This issue is related to: 

**Detailed Description:**

In line with #5746, this changes how parameters are interpolated in redirectTo strings.

First, I added a test case (it's my first in Javascript ever, so bear with me) which exhibits the failure:

```
        Expected '/bar/id1/subid3?/23' to equal '/bar/id1/subid3/23'.
        Error: Expected '/bar/id1/subid3?/23' to equal '/bar/id1/subid3/23'.
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:826:34)
            at Object.invoke (/home/vtc/src/angular.js/src/auto/injector.js:801:17)
            at workFn (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2187:20)
            at window.inject.angular.mock.inject (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2159:42)
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:822:7)
        Expected '/bar/id1/?/23' to equal '/bar/id1/23'.
        Error: Expected '/bar/id1/?/23' to equal '/bar/id1/23'.
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:832:34)
            at Object.invoke (/home/vtc/src/angular.js/src/auto/injector.js:801:17)
            at workFn (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2187:20)
            at window.inject.angular.mock.inject (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2159:42)
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:822:7)
        Expected '/path/foovalue/barvalue*/1' to equal '/path/foovalue/barvalue/1'.
        Error: Expected '/path/foovalue/barvalue*/1' to equal '/path/foovalue/barvalue/1'.
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:837:34)
            at Object.invoke (/home/vtc/src/angular.js/src/auto/injector.js:801:17)
            at workFn (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2187:20)
            at window.inject.angular.mock.inject (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2159:42)
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:822:7)
```

Alas, the fix from Pasvaz in #5746 lead to an error too:

```
        Expected '/bar/id1//23' to equal '/bar/id1/23'.
        Error: Expected '/bar/id1//23' to equal '/bar/id1/23'.
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:832:34)
            at Object.invoke (/home/vtc/src/angular.js/src/auto/injector.js:801:17)
            at workFn (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2187:20)
            at window.inject.angular.mock.inject (/home/vtc/src/angular.js/src/ngMock/angular-mocks.js:2159:42)
            at null.<anonymous> (/home/vtc/src/angular.js/test/ngRoute/routeSpec.js:822:7)l
```

Note the doubled slash, which is kind of awkward. So, a slash should be removed when the optional parameter is missing.

Now string interpolation is done similar to the generation of the regexp in route, using a replace function.

All good, tests pass.

**Other Comments:**

I don't know what your preference is, should I reorder the commits in order to keep the tests passing for every single commit?
should test that `$route.current.params` equal what we expect, not just `$location.search()` (for each of these cases).