ng-grid 在 IE8 中不起作用 [英] ng-grid not working in IE8
问题描述
我想弄清楚为什么 ng-grid 在 IE8 中不起作用.我收到这个错误:Expected identifier, string or number ng-grid-2.0.5.debug.js, line 1535 character 17
.
I'm going nuts trying to figure out why ng-grid isn't working in IE8. I get this error: Expected identifier, string or number ng-grid-2.0.5.debug.js, line 1535 character 17
.
我直接从 ng-grid 主页复制了一个示例(顺便说一下,那里的所有示例都正确加载).这里有人有想法吗?
I'm copying an example straight from the ng-grid homepage (all the examples there load correctly, by the way). Anyone have an idea here?
我会放一个 Plnkr 或 fiddle,但两者都不会在 IE8 中加载,所以它有点违背了目的.
I would put up a Plnkr or fiddle, but neither will even load in IE8, so it kind of defeats the purpose.
使用 Angular 1.0.4、jQuery 1.8.1、ng-grid 2.0.5
using Angular 1.0.4, jQuery 1.8.1, ng-grid 2.0.5
html
<html ng-app="myApp">
<head lang="en">
<meta charset="utf-8">
<title>Getting Started With ngGrid Example</title>
<link rel="stylesheet" type="text/css" href="ng-grid.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery-1.8.1.js"></script>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="ng-grid-2.0.5.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body ng-controller="MyCtrl">
<div class="gridStyle" ng-grid="gridOptions"></div>
</body>
CSS
.gridStyle {
border: 1px solid rgb(212,212,212);
width: 400px;
height: 300px;
}
Javascript
var app = angular.module('myApp', ['ngGrid']);
app.controller('MyCtrl', function($scope) {
$scope.myData = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
$scope.gridOptions = {
data: 'myData',
columnDefs: [{field:'name', displayName:'Name'}, {field:'age', displayName:'Age'}]
};
});
推荐答案
事实证明答案并不那么明显.在 ng-grid 2.0.5 中存在一个错误,其中开发人员在一个地方使用 Javascript forEach 方法而不是 angular.forEach.这不受 IE8 支持并导致错误.我把它提交给了小组,他们会修复它,但现在我只是做了更改.
Turns out the answer was not so obvious. There was a bug in ng-grid 2.0.5 where the devs were using the Javascript forEach method in one spot instead of angular.forEach. This is not supported by IE8 and was causing the error. I submitted it to the group and they'll fix it, but for now I just made the change.
这篇关于ng-grid 在 IE8 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!