angularjs location.search ie9 ie8

时间:2014-06-19 23:01:54

标签: angularjs internet-explorer-8 internet-explorer-9

我是AngularJS的新手,我正在尝试使用$ location.search读取查询字符串键值对。以下代码适用于Chrome,IE10和Firefox:

var app = angular.module('myApp', []);

app.config(function($locationProvider){
    $locationProvider.html5Mode(true).hashPrefix('!');
});

 app.controller('ParamController', function($scope, $location, $window) {
     console.log($location.search()['term']);
 });

在IE8 / 9上,页面会立即以“#!”重新显示在网址中,例如。从/demo/angularJS/index.html到/#!/ demo / angularJS / index.html

AngularJS中有没有办法在IE8 / 9中读取和解析查询字符串parms?

0 个答案:

没有答案