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 an url as below

http://www.something.com/sometest/test/#registration

some logic is written based on #registration for IE.

Now as I am using angular js and it is redirecting as follows which is breaking the logic.

http://www.something.com/sometest/test/#/registration

I thought of html5 mode but it is creating other issues like links in my page are not working only the url is getting updated(which is expected when we use html5mode I guess). So, I dont want to use html5mode. I just want to stop that # thing from redirecting to /#/.

please let me know how to disable this redirecting

Note: I am not using routing and I don't need it. I dont want to use html5mode as well. This is and existing implementation and I need to use it in angular js app to open a popup or something.

share|improve this question
    
did you also configure the server for html5 mode ? – Deep 17 hours ago
    
I don´t know if this can help you but check this answer stackoverflow.com/questions/32626081/… – stalin 16 hours ago
    
I fixed the issue myself. It was due the injection of $location service to the controller. – Susheel Singh 15 hours ago

If your application runs under /sales/ try to set the base path in your index.html and switch on html5Mode:

<base href="/sales/index.html" />

otherwise,

<base href="/" />

If you're using IE9, then HTML5mode will work as IE9 is not supporting HTML5 History API

function supports_history_api() {
  return !!(window.history && history.pushState);
}

see using $location

This will work!

Cheers :)

share|improve this answer
    
html5mode breaking some other stuff as well. I dont want to use it – Susheel Singh 17 hours ago
    
which version of angular you're using? I don't see it breaking a lot of application – varit05 17 hours ago
    
    
I already mentioned in my question I dont want to use html5mode – Susheel Singh 17 hours ago
    
I am sure you're doing something wrong, plus your post isn't saying you don't want to use html5mode. it says you have used but didn't work – varit05 17 hours ago

I fixed the issue myself. It was due the injection of $location service to the controller.

//issue
app.controller("testController", ["$scope", "$location", function($scope, $location) {

}]);

I removed the $location service from the controller and the issue was resolved.

//resolved
app.controller("testController", ["$scope", function($scope) {

}]);
share|improve this answer

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.