Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

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.

share|improve this question
1  
If you don't have any routes, why did you define routing at all? – Josh David Miller Apr 3 '13 at 6:44
3  
Remove anything related to $routeProvider from your app (config) – finishingmove Apr 3 '13 at 7:21
    
if you know about Html5Mode, its needed when you use routing at all.Just remove all $routeProvider from the app – UR13X Apr 3 '13 at 12:48
up vote 1 down vote accepted

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

share|improve this answer
7  
This is not the case. Hash urls are modified by angular even if the ng app does not use the router. – greg.kindel Nov 6 '13 at 20:46
3  
Agreed. It appears that ng-include will turn on routing, even when you use no other Angular features. Are you using ng-include? – Sharky Mar 26 '14 at 19:17
    
@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 – edrian Nov 4 '15 at 12:47
    
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. – Sharky Nov 5 '15 at 19:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.