1

The situation is the Oauth server will redirect to my site with this url:

$location.absUrl():http://abcdefg.com/?code=0415fca7f0b126554c768d8fafcba1eL&state=STATE#/wechat

However, the result of the $location.search().code is undefined

So, I want a correct way to get the code part of the URL.

1
  • what is the result of $location.search()? (to see if code is trying to access an empty object, if it has state, etc) Commented May 25, 2015 at 8:39

2 Answers 2

1

You can use $location.search().code get the value from query string.

Sign up to request clarification or add additional context in comments.

2 Comments

However, the result of the $location.search().code is undefined
See my post, the result is undefined,Only this way $location.search().code can get the value: abcdf.com/#/…
0

Try taking taking $location string, finding the '=' index with indexOf, and splicing the code from index+1 (to skip the '=') to indexOf('&'). It's a little dirty, but could get you on your way.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.