How do I parse URL params after a hash with Angularjs?

后端 未结 4 1299
挽巷
挽巷 2020-12-29 06:36

I\'m trying to parse for the access_token from Foursquare where the URL is like this:

https://mywebsite.com/4sqredirect/#access_token=1234567890XXXXX

I\'ve t

4条回答
  •  独厮守ぢ
    2020-12-29 06:59

    Use $location.search()

    //e.g. url https://www.example.com/#!?name=123
    var s = $location.search();
    // {name: '123'}
    

    http://docs.angularjs.org/api/ng.$location

    Search:

    Returns search part (as object) of current url when called without any parameter.

提交回复
热议问题