I am using angularjs 1.2.10,ngRoute and the default html5 mode of false. Using the follow url example:
http://example.com/#/route?message=test+message
In Chrome,firefox, and IE9 I am noticing the following parameter conversion:
?message=test+message - > ?messagetest%2Bmessage
I am logging the nextLocation & currentRoute,nextRoute in the $locationChangeStart/$locationChangeSuccess & $routeChangeStart/$routeChangeSuccess event handlers respectively and I am seeing the following output:
locationChangeStart: http://example.com/#/route?message=test+message
locationChangeSuccess: http://example.com/#/route?message=test%2Bmessage
routeChangeStart: currentRoute: /route, nextRoute: /route
routeChangeSuccess: currentRoute: /route, nextRoute: /route
...
locationChangeStart: http://example.com/#/route?message=test%2Bmessage
locationChangeSuccess: http://example.com/#/route?message=test%2Bmessage
routeChangeStart: currentRoute: /route, nextRoute: /route
routeChangeSuccess: currentRoute: /route, nextRoute: /route
The route and its associated controller is getting instantiated twice which is undesirable. Is there a way to prevent this double instantiation or rewrite of '+' to %2B.
A similar behavior occurs when the parameter value has a space. In Chrome,IE9, the following conversion occurs:
?message=test message - > ?message=test%20message
However, this rewrite(and subsequent double route load) does NOT happen in firefox, which leads me to believe this is a browser specific behavior.
I don't have direct control of how the parameters are formed, an iframe in our site is doing a redirect to the 'top' location 'http://example.com/#/route' along with the parameters it adds.