-
Notifications
You must be signed in to change notification settings - Fork 232
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
$location.search() problems #32
Comments
@markusklooth - I have had trouble with this in the past. My approach has been to work around the problem on the server-side, ensuring that the generated URL is something that angular understands. Will this approach work for you, or do you have another suggestion? |
Could we do something like this? getParamByName: function(name) {
// Check if param is set in url#hash
if($location.search()[name] !== void 0) { return $location.seach()[name]; }
// Otherwise check url params
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? void 0 : decodeURIComponent(results[1].replace(/\+/g, " "));
} And then call |
I came up with the following solution: |
@markusklooth - I'm reluctant to implement a custom URL parser if angularjs itself can't get it right. I have several concerns here:
And if we were actually able to solve the problem, it would be better to push the fix upstream to angular. I'm going to fix the issue server-side for now. |
I just saw your latest comment. I'm going to implement something like that on the server. |
@markusklooth - I think this is fixed in devise_token_auth version |
The usage of $location.search() within the
validateUser
function is unreliable, if you have $locationProvider.html5Mode equals false which is most likely the case if you are using the ionic framework.For instance:
When clicking on the confirmation button, the browser is redirected to the following url:
http://localhost:8100/?account_confirmation_success=true &client_id=[client_id] &expiry=[expiry] &token=[token] &uid=[uid]
Inside the
validateUser
function, the following will always return undefinedsince
$location.search()
will return an empty object.See angular/angular.js#7239 for more information
The text was updated successfully, but these errors were encountered: