2

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.

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?

I would put up a Plnkr or fiddle, but neither will even load in IE8, so it kind of defeats the purpose.

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

2 回答 2

5

原来答案并不那么明显。ng-grid 2.0.5 中有一个错误,开发人员在一个地方使用 Javascript forEach 方法而不是 angular.forEach。IE8 不支持此功能并导致错误。我将它提交给小组,他们会修复它,但现在我只是进行了更改。

于 2013-05-07T14:22:52.763 回答
1

Internet Explorer 需要特殊处理才能适应 AngularJS。请阅读这个。

http://docs.angularjs.org/guide/ie

于 2013-05-04T14:57:31.553 回答