我有一个非常简单的Angular应用程序,可以在Firefox和Chrome中按预期工作,但在IE中不起作用。
index.html是这样的:
<!DOCTYPE html>
<html ng-app="angularFormsApp">
<head>
<title></title>
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/angular.min.js"></script>
<script src="Scripts/angular-route.min.js"></script>
<script src="app/AngularFormsApp.js"></script>
<script src="app/EmployeeForm/efController.js"></script>
<script src="app/EmployeeForm/efDirective.js"></script>
<script src="app/EmployeeForm/efService.js"></script>
</head>
<body ng-controller="efController" class="container">
<h1>Start Page</h1>
<div ng-view>
</div>
</body>
</html>
我的AngularFormsApp.js定义如下:
var angularFormsApp = angular.module('angularFormsApp', ["ngRoute"]);
angularFormsApp.config(function ($routeProvider) {
$routeProvider
.when("/home", {
templateUrl: "app/Home.html",
controller: "HomeController"
})
.when("/newEmployeeForm", {
templateUrl: "app/EmployeeForm/efTemplate.html",
controller: "efController"
})
.otherwise({
redirectTo: "/home"
});
});
angularFormsApp.controller("HomeController",
function ($scope, $location) {
$scope.addNewEmployee = function () {
$location.path('/newEmployeeForm');
};
});
我的Home.html只包含一个按钮:
<input type="button" class="btn btn-primary" value="Add New Employee" ng-click="addNewEmployee()" />
启动应用程序后,index.html应重定向到
http://localhost:65294/index.html#/home
我应该看到&#34;添加新员工&#34;我在Chrome和Firefox中看到的按钮,但在IE中没有。当我在IE中启动应用程序时,显示的URL是
http://localhost:65294/index.html
我没看到按钮。所以它接缝好像重定向不起作用,但只在IE中。即使我在浏览器的地址栏中输入了正确的网址,我仍然没有看到该按钮。
那么IE有什么不同?