Update2:
$location just for ng.
so $location.search
is ng's search
it parse url from mark like # or #! .
but $window.location
handle the brower url
in my question, first url's ng search is empty and second url's ng search is {code & state}
is it right?
Update1:
i found the *$window.location*
got the right data.
is *$location*
override the all things?
Question
i use angular-ui-router in my project. and i want to get search string from url,
like this: http://localhost:8080/?code=123456&state=auth#/api/oauth2_authorize
in app.config, i set:
$stateProvider.state("oauth2_authorize", {
url: "/api/oauth2_authorize?code&state",
template: "",
controller: function($location) {
var search = $location.search();
}
})
i think the search will be { code : 123456; state:auth}
but no.
i try to change the url to : http://localhost:8080/#/api/oauth2_authorize?code=123456&state=auth
and it work.
somebody could tell me why? the html5mode is false. i check the angularjs's document, and $location's sample show that, i can get the search string from both url. and i try to use $urlRouterProvider , but it still empty.
what can i do?