Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

basic ng-grid example not working

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.

Here is my 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>

Here is my 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";
});

I also created an example of my issue in Plunker here: http://plnkr.co/edit/9fEF8sBAMhaMxWimLfTn?p=preview

Thanks!

Shanna

like image 400
user2827707 Avatar asked Dec 20 '22 07:12

user2827707


1 Answers

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

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

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

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

found here.

like image 188
Patrick Motard Avatar answered Dec 28 '22 09:12

Patrick Motard