I just updated to Angular 2.0.0-rc5 and my listener for the current page url seems to have been deprecated.
Previously I could access it by subscribing to the following:
Look for router.events
and subscribe to that. The typical event will be NavigationEnd
and this will give you the url information that you need.
router.events.subscribe(x => {
if(x instanceof NavigationEnd) {
console.log(x.url);
console.log(x.urlAfterRedirects);
}
});
Note that there are other kind of events too, but the basic scenario uses NavigationEnd
.