不工作基本NG-电网为例 [英] basic ng-grid example not working

查看:229
本文介绍了不工作基本NG-电网为例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来angularjs和NG-格......我目前正在经历一个简单的exampe为NG-格,但我似乎无法得到它的工作。

I'm new to angularjs and ng-grid...I'm currently going through a simple exampe for ng-grid, but I can't seem to get it to work.

下面是我的html:

<!DOCTYPE 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="https://cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.css" data-semver="2.0.11" data-require="ng-grid@*" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" data-semver="2.1.1" data-require="jquery@*"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.7/angular.js" data-semver="1.3.7" data-require="angular.js@*"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.min.js" data-semver="2.0.11" data-require="ng-grid@*"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-controller="MyCtrl">
<h1>{{title}}</h1>
<div class="gridStyle" ng-grid="gridOptions">
</div>
</body>
</html>

下面是我的JS:

'use strict';

var app = angular.module('myApp', ['ui.grid']);
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' };
  $scope.title = "ng-grid example";
});

我还创建了我的Plunker问题的例子在这里:的http:// plnkr .CO /编辑/ 9fEF8sBAMhaMxWimLfTn?p = preVIEW

谢谢!

莎娜

推荐答案

你来自哪里找到的这里错误地指出以下

The documentation where you got this from found here incorrectly states the following

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

在同一页面上他们plunkr环节都有正确的语法

Their plunkr link on that same page has the correct syntax of

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

这里。

这篇关于不工作基本NG-电网为例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆