AngularJS-如何关闭hashbang模式



我有一个网页,上面有两个AngularJS应用程序。因为有两个应用程序,我必须将应用程序引导到页面上。我正在引导这样的应用程序:

// 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']);

我的问题是,如何完全关闭hashbang?我没有使用AngularJS进行视图管理。我正在用它做其他事情。不过,出于某种原因,当我访问一个带有Angular的IE8页面时,用户会被重定向到一个带有hashbang的页面。hashbang会导致服务器端错误。出于这个原因,我需要关掉它。我该怎么做?

您可以打开有角度的html5推送状态,该状态应该可以擦除任何哈希刘海:

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

最新更新