How to use Querystring with $location.path() in AngularJS

后端 未结 2 779
误落风尘
误落风尘 2021-01-01 14:52

I want to redirect user to another page after successful login using query string. If I copy & paste to browser\'s address bar http://example.com/#/login?ref=/path

相关标签:
2条回答
  • 2021-01-01 15:13

    It should be

    $location.path('/login').search('ref', '/path/to/redirect')
    
    0 讨论(0)
  • 2021-01-01 15:27

    I had the same problem.

    I want to change path and search the same time.

    It is possible by doing this:

    $location.$$search ={foo:'bar', buz:'buz'}
    $location.$$path = '/some/path'
    $location.$$compose()
    

    It is not documented and it could broke at any new angular version.

    0 讨论(0)
提交回复
热议问题