9

I have a single page application that really just has one single page. There's just the one view that has lots of javascript/ajax logic done with angularjs, but there's no routing to other views involved.

Therefore I'd like to git rid of the hashbang (#/) at the end of the url. Can I somehow turn off angularjs routing completely?

Btw: I know about Htm5Mode, but I want it to work in all browsers.

4
  • 1
    If you don't have any routes, why did you define routing at all? Commented Apr 3, 2013 at 6:44
  • 3
    Remove anything related to $routeProvider from your app (config) Commented Apr 3, 2013 at 7:21
  • if you know about Html5Mode, its needed when you use routing at all.Just remove all $routeProvider from the app Commented Apr 3, 2013 at 12:48
  • I believe I also had to remove $location Commented May 18, 2016 at 16:04

1 Answer 1

2

If you don't have a $routeProvider defined, there will be no routing, and therefore no hash in your url.

Sign up to request clarification or add additional context in comments.

5 Comments

This is not the case. Hash urls are modified by angular even if the ng app does not use the router.
Agreed. It appears that ng-include will turn on routing, even when you use no other Angular features. Are you using ng-include?
@Sharky did you find a way to avoid this behavior when using ng-include? I have a single-page parallax using controllers but not routing, and when using ng-include angular replaces anchor url from this #clients to this #/clients
I did, but unfortunately, I no longer remember how I did it. But I can tell you for sure that it's possible. I think it had something to do with intercepting functionality in a core Angular service through some form of delegation.
I believe I also had to remove $location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.