href="#" causes location address to change, can we avoid it?

angularjs, angularjs-routing

Solution

Try doing:

<a href="javascript:void(0);">Home</a>

Problem

I have a number of tabs that I handle special logic so no location bar address change should occur. I have the following ``` <a href="#">Home</a> ``` This behaves as expected, i.e. it gives me the hand mouse pointer when hovering over the buttons but clicking on then starts the route change. I want to be able to stop this. I tried just remove the `href` or setting `href=""`, seemed to have some success but it gave unexpected results when hovering. What is the best practice here? Do I have to remove the href? So then I will need to style the tab using CSS to give me the mouse pointer when hovering? If I do leave the `href="#"` in the link then this causes a change of routing which is not what I was looking for. I actually handle my login in a `ngClick` for each tab. This logic must not change the route. Any ideas?

Original source

Related problems