I have this code:
var search = $location.search();
if (angular.isDefined(search.load) && search.load != null) {
if (search.load = "confirmEmail")
authService.confirmEmailUserId = search.userId;
authService.confirmEmailCode = search.code;
$state.transitionTo("auth.content", {
content: search.load
});
}
It's in the app.run and it looks at the URL used to open the app.
But search.code was encoded with the C#
var callbackUrl = "http://localhost:2757/index.html" +
"?load=email" +
"&userId=" + user.Id +
"&code=" + HttpUtility.UrlEncode(code);
How can I get back the original value of code before it was passed to UrlEncode?
You could use the decodeURIComponent()
JavaScript function. This function takes as parameter an URL encoded string and returns its unencoded form.
In your case, you could either decode the entire URL
var search = decodeURIComponent($location.search());
or just the code part
authService.confirmEmailCode = decodeURIComponent(search.code);
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다