AngularJS - How to disable hashbang mode

I have a webpage that has two AngularJS applications on it. Since there are two applications, I have to upload applications to the page. I download applications as follows:

// Bootstrap the first app
var app1 = angular.module('app-1', []);
app1.controller('App1Controller', ['$scope', '$window', function ($scope, $window) {
}]);
angular.bootstrap($('#app1'), ['app-1']);

// Bootstrap the second app
angular.bootstrap($('#app-2'), ['my-app-name']);

My question is: how do I disable hash bang? I do not use AngularJS to control the viewing. I use it for other things. However, for some reason, when I visit a page with IE8 using Angular, the user is redirected to the page using hashbang. A hashbang causes a server-side error. For this reason, I NEED to disable this. How to do it?

+4
source share
1 answer

You can enable the angular html5 push state, which should clear any hash signals:

app1.config(['$locationProvider', function($locationProvider) {
     $locationProvider.html5Mode(true);
}]);
+5

All Articles