Skip to content

Conversation

@stephanvierkant
Copy link
Contributor

'#' is giving problems when using hash url's, i.e. w/ AngularJS.

'#' is giving problems when using hash url's, i.e. w/ AngularJS.
@isometriks
Copy link
Collaborator

Couldn't you just do something like this:

$('.nav .dropdown').click(function(e) {
    e.preventDefault();
});

I honestly don't know if changing this will have any other side effects, I've always thought it pretty standard to use #. I guess if there's no issues we could change it, but it can be easily solved otherwise.

@isometriks
Copy link
Collaborator

http://getbootstrap.com/examples/navbar/ Also doesn't seem to even trigger the hash in the URL. Seems like they're already preventing the default

@phiamo
Copy link
Owner

phiamo commented Apr 27, 2015

@isometriks @stephanvierkant so is this eventually not necessary at all ?!

@stephanvierkant
Copy link
Contributor Author

Yes, it is. I had some problems while using AngularJS. I think you shouldn't use '#'. See http://stackoverflow.com/a/15885150/1405981

@phiamo
Copy link
Owner

phiamo commented Apr 27, 2015

i think you shouldnt use ie but thats another point as far as i can read the whole thing ad the answers http://stackoverflow.com/questions/5637969/is-an-empty-href-valid?answertab=votes#tab-top
i would say it would be best to make it omitable e.g. having a global conf option
@stephanvierkant would you add a pr for this and add some doc, including the link to stackoverflow?

@isometriks
Copy link
Collaborator

We could make it configurable but I still don't think this is an issue. Bootstrap should be preventing the default action of the # behavior so that it doesn't trigger a new history entry or go to the top of the page. If the preventDefault() code I posted earlier doesn't work then you might need to find another hack for whatever version of IE isn't working or check that angular isn't binding extra events to your links. None of my navbars nor the official one cause the hashtag to show up at all because the event is being cancelled.

@phiamo
Copy link
Owner

phiamo commented Apr 27, 2015

ok but then probably we should put that in the docs somewhere :/

@phiamo
Copy link
Owner

phiamo commented Feb 3, 2017

might also be connected with #1155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants