为什么我的 UI 网格无法加载网格

Why my UI Grid cannot load the grid

Here is my runnable plunker

我遵循了 UI Grid official tutorial 中的教程。 我不知道为什么我无法加载网格。我没有发现任何语法错误。

以下是来自控制台的部分错误:

URL visited / editor-1.2.0.js:2 URL visited /?p=catalogue emmet.js Failed to load resource: the server responded with a status of 404 (Not Found) editor-1.2.0.js:7 AUTH Object editor-1.2.0.js:2 Event tracked Plunk Beautify Toolbar undefined undefined editor-1.2.0.js:2 Event tracked Plunk Save Toolbar undefined undefined editor-1.2.0.js:2 URL visited /oXEt5IfdrpkkPSxysncy?p=catalogue editor-1.2.0.js:2 Event tracked Multipane Show Preview Toolbar undefined undefined editor-1.2.0.js:2 URL visited /oXEt5IfdrpkkPSxysncy?p=preview run.plnkr.co/:1 Mixed Content: The page at 'https://plnkr.co/edit/oXEt5IfdrpkkPSxysncy?p=preview' was loaded over HTTPS, but requested an insecure script 'http://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js'. This request has been blocked; the content must be served over HTTPS.

<!DOCTYPE html>
<html ng-app="app">

<head>
    <link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css">
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
    <script src="http://ui-grid.info/release/ui-grid.js"></script>
</head>

<body>
    <h1>Hello Plunker!</h1>

    <div ng-controller="MainCtrl">
        <div ui-grid="{ data: myData }" class="myGrid"></div>
    </div>

    <script>
        var app = angular.module('app', ['ui.grid']);
        app.controller('MainCtrl', ['$scope', function($scope) {
            $scope.myData = [{
                    "firstName": "Cox",
                    "lastName": "Carney",
                    "company": "Enoromo",
                    "employed": true
                }, {
                    "firstName": "Lorraine",
                    "lastName": "Wise",
                    "company": "Comveyer",
                    "employed": false
                }, {
                    "firstName": "Nancy",
                    "lastName": "Waters",
                    "company": "Fuelton",
                    "employed": false
                }
            ];
        }])
    </script>

    <style>
        .myGrid {
            width: 500 px;
            height: 250 px;
        }
    </style>
</body>

</html>

您的 ui-grid 的 cdn 不正确。你所有的 src 都应该指向一个安全的 url,即 https。原因是您正试图从安全站点访问不安全的脚本。这将被阻止,因为只能通过 HTTPS 提供内容。

  <head>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-grid/4.0.6/ui-grid.css" type="text/css">
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-grid/4.0.6/ui-grid.min.js"></script>
  </head>

工作 Plunkr:https://plnkr.co/edit/I87wgFzlqmtl6dcPem6F?p=preview