angular/angular.js — pull request #8200 by avdv (2014-07-15 11:30:18+00:00)
Title: improve interpolation of params in ngRoute

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. (/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. (/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. (/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. (/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. (/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. (/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. (/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. (/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.

I don't know what your preference is, should I reorder the commits in order to keep the tests passing for every single commit?