When a page loads, I want to determine what url was used to load that page and intercept it in the controller so I can extract the parameters from it.
For example if http://mypage.com/#/myPage/otherStuff
How can I intercept this URL before the page loads?
Thank you.
(Use case) 1. user requests my page 2. I intercept, take out the parameters from the url 3. I format the page to match their parameters.
It sounds like you're looking for these events (read the docs here).
$scope.$on("$locationChangeStart", function (event, nextLocation, currentLocation) {
});
From reading the comments, I see that your question is an X/Y issue. My answer deals with your question of intercepting the url in the controller, but it looks like your overall goal is better accomplished by other means.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.