diff options
| author | joshkurz | 2013-04-26 17:31:56 -0400 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-07-01 19:32:12 +0100 |
| commit | 807394095b991357225a03d5fed81fea5c9a1abe (patch) | |
| tree | 5e2d1a6eb337f2fcb7dfc7a7bc76a271f6ae7af5 /lib/grunt/plugins.js | |
| parent | a258817310e83ae58a0ce95226e77a9f151d7197 (diff) | |
| download | angular.js-807394095b991357225a03d5fed81fea5c9a1abe.tar.bz2 | |
fix(Angular.js): handle duplicate params in parseKeyValue/toKeyValue
parseKeyValue and toKeyValue can now handle duplicate values in the query.
```
?x=1&x=2 <-> {x:[1,2]}
```
The algorithm looks like:
1)parseKeyValue looks for presence of obj[key]
2)detects and replaces obj[key] with [obj[key],val]
3)then pushes more duplicates if necessary
4)toKeyValue decodes array correctly
5)(not changed)$location.search({param: 'key'}) still replaces if necessary
6)(not changed)$location.search({param: ['key1', 'key2']}) sets the url with duplicates
BREAKING CHANGE: Before this change:
- `parseKeyValue` only took the last key overwriting all the previous keys;
- `toKeyValue` joined the keys together in a comma delimited string.
This was deemed buggy behavior. If your server relied on this behavior
then either the server should be fixed or a simple serialization of
the array should be done on the client before passing it to $location.
Diffstat (limited to 'lib/grunt/plugins.js')
0 files changed, 0 insertions, 0 deletions
