diff options
| author | Gonzalo Ruiz de Villa | 2012-12-11 11:41:53 +0100 |
|---|---|---|
| committer | Igor Minar | 2012-12-14 01:15:15 +0100 |
| commit | 30a9da5dc159dd1e19b677914356925c7ebdf632 (patch) | |
| tree | 794f2f94e7816572bba8c0d147f1621a2c581ff3 /test/ng/routeParamsSpec.js | |
| parent | 25e1ad9a9443de6b7ebb40409af72021cc4e7b20 (diff) | |
| download | angular.js-30a9da5dc159dd1e19b677914356925c7ebdf632.tar.bz2 | |
fix($route): correctly extract $routeParams from urls
Routes like '/bar/foovalue/barvalue' matching '/bar/:foo/:bar'
now are well mapped in $routeParams to:
{bar:'barvalue', foo:'foovalue'}
Closes: #1501
Signed-off-by: Gonzalo Ruiz de Villa <gonzaloruizdevilla@gmail.com>
Diffstat (limited to 'test/ng/routeParamsSpec.js')
| -rw-r--r-- | test/ng/routeParamsSpec.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ng/routeParamsSpec.js b/test/ng/routeParamsSpec.js index e3aac1a2..07c6d4f7 100644 --- a/test/ng/routeParamsSpec.js +++ b/test/ng/routeParamsSpec.js @@ -17,4 +17,16 @@ describe('$routeParams', function() { expect($routeParams).toEqual({barId:'123', x:'abc'}); }); }); + + it('should correctly extract the params when a param name is part of the route', function() { + module(function($routeProvider) { + $routeProvider.when('/bar/:foo/:bar', {}); + }); + + inject(function($rootScope, $route, $location, $routeParams) { + $location.path('/bar/foovalue/barvalue'); + $rootScope.$digest(); + expect($routeParams).toEqual({bar:'barvalue', foo:'foovalue'}); + }); + }); }); |
