AngularJS $ locationChangeStart的问题

时间:2015-04-20 14:28:06

标签: javascript angularjs internet-explorer

我有一个方法:

$scope.$on('$locationChangeStart', function (event, next, current) { 
    //......
}

但是当我使用谷歌Chrome浏览器时,我有:

current = localhost:8080/index.html#/step1
next = localhost:8080/index.html#/step2

当我使用Internet Explorer时,我有:

current = localhost:8080/index.html#/step2
next = localhost:8080/index.html#/step1

如何配置AngularJS,而不是我在不同的浏览器中配置:

current = localhost:8080/index.html#/step1
next = localhost:8080/index.html#/step2

1 个答案:

答案 0 :(得分:0)

Angular documentation

  

newState和oldState参数只能在HTML5模式下定义,并且当浏览器支持HTML5 History API时。

遗憾的是,HTML5历史记录API only available for IE >= 10

如果你不得不支持IE,我恐怕你必须找到另一种方式< 10 ...