-
Notifications
You must be signed in to change notification settings - Fork 3k
using caseInsensitiveMatch with stateProvider #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's not supported by $stateProvider at the moment. What's the use case for this? Are you getting users to type in URLs to states manually, or why would the links not end up matching the case of the URL as defined in the state? |
yes, it's exactely that. I've got users typing or pasting a URL which contains upper-case letters and they get a 404. To workaround this issue, I've used a URL rewrite rule on the server to force lower-case, but then I get a lot of 301 requests, which is not ideal. In my opinion this is a must-have feature to be able to run case-insensitive requests. |
If they were pasting surely the case would be correct? Anyway you should be able to do something like this:
|
sometimes the url is copied from some Excel sheet with bad formatting. Anyway, that's not the point. They often type with the caps lock key on too. Thanks for this code. Where should I use it ? I've tried to put it in the .config() but it fails as $location is undefined :
|
try removing the |
Yes, that works fine now. Thanks a lot ! |
I'm reopening this issue because I've noticed that my base url is case sensitive. This thread on SO explains the issue: http://stackoverflow.com/questions/14994324/angularjs-base-href-case-sensitive Adding the custom rule to UrlRouteProvider works fine for the part AFTER the base URL. However if the base URL is entered in upper-case, then it does not work because the base URL is defined in lower-case in my index.html page. The fix provided on SO is for the routeProvider of AngularJS. What should I do to fix this with the $UrlRouteProvide ? |
@ksperling What is the latest set of parameters for the rule() method? I want to add it to the wiki! It is $injector and $location in the src currently, but are you saying that $injector is now removed? |
I'm having the same issue with base href being case sensitive. |
same goes here |
Plunkr? |
How can one test base url in Plunker? |
<script>
document.write('<base href="' + location.toString().toUpperCase() + '" />');
</script> ? |
Don't think that talk about the matching of Base Ref is in the right place here, ui-router uses $location.$path() which is meant to not include the "base ref" part (AFAIK), meaning that it is more likely to be within the implementation of $location the problem lies. |
@jeme Ordinarily I would agree, but there seems to be equivalent functionality in the Angular core router. |
@nateabele Not for base path handling, or well I can't find the code in their router that does that. As far as I can tell from their code they also just relies on what $location.$path() returns. And so I won't be terrible surprised if their router suffers from that as well. |
Okay, agreed that this is a |
I'm trying to understand what is the use case of having case sensitive url, I have lots of cases where case sensitive urls are an issue. why not simply do: instead of .m |
@mauroservienti feel free too submit a PR, I'm not opposed to having case insensitive urls |
PR done :-) it’s my first time, so be patient :-P On 09/mar/2014, at 03:23, Tim Kindberg <[email protected]mailto:[email protected]> wrote: @mauroservientihttps://github.com/mauroservienti feel free too submit a PR, I'm not opposed to having case insensitive urls — |
In AngularJS RouteProvider, the attribute caseInsensitiveMatch can be used on each individual routes.
How do I do that with the stateProvider ?
The text was updated successfully, but these errors were encountered: