I need to identify when an anchor is changed and so call a function
Where I set the fragment:
changeFragment(id) {
this.router.navigate([], { fragment: id });
}
Any help is welcome, thanks
I need to identify when an anchor is changed and so call a function
Where I set the fragment:
changeFragment(id) {
this.router.navigate([], { fragment: id });
}
Any help is welcome, thanks
Inject ActivatedRoute service in construtor, Then use fragement method in Activatedroute to listen fragement changes
Try this:
this.route.fragment.subscribe( fragment =>{
console.log(fragment);
})