AngularJS: How to clear query parameters in the URL?

后端 未结 16 2628
余生分开走
余生分开走 2020-12-04 14:40

My AngularJS application needs to have access to the user\'s LinkedIn profile. In order to do that I need to redirect the user to a LinkedIn URL which contains a callback re

16条回答
  •  不思量自难忘°
    2020-12-04 15:27

    Need to make it work when html5mode = false?

    All of the other answers work only when Angular's html5mode is true. If you're working outside of html5mode, then $location refers only to the "fake" location that lives in your hash -- and so $location.search can't see/edit/fix the actual page's search params.

    Here's a workaround, to be inserted in the HTML of the page before angular loads:

    
    

提交回复
热议问题