简体   繁体   English

AngularJS ng-Grid注入错误

[英]Angularjs ng-Grid injection error

I have used below code while using ngGrid. 我在使用ngGrid时使用了以下代码。

var MyApp = angular.module("MyApp", ['ngGrid','ngRoute', 'ProductService']);

But it gave me following error. 但这给了我以下错误。

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp due to: Error: [$injector:modulerr] Failed to instantiate module ngGrid due to: Error: [$injector:nomod] Module 'ngGrid' is not available! angular.js:68未捕获的错误:[$ injector:modulerr]由于以下原因未能实例化模块MyApp:错误:[$ injector:modulerr]由于以下原因而未能实例化模块ngGrid:错误:[$ injector:nomod]模块'ngGrid'不可用! You either misspelled the module name or forgot to load it. 您可能拼错了模块名称,或者忘记了加载它。 If registering a module ensure that you specify the dependencies as the second argument. 如果注册模块,请确保将依赖项指定为第二个参数。

As per the suggestions in stack overflow then i changed my code as below. 根据堆栈溢出的建议,然后我如下更改了我的代码。

var MyApp = angular.module("MyApp", ['ui.grid','ngRoute', 'ProductService']);

But Still i got a different error. 但是仍然我有一个不同的错误。

angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp due to: Error: [$injector:modulerr] Failed to instantiate module ui.grid due to: Error: [$injector:nomod] Module 'ui.grid' is not available! angular.js:68未捕获的错误:[$ injector:modulerr]由于以下原因未能实例化模块MyApp:错误:[$ injector:modulerr]由于以下原因而未能实例化模块ui.grid:错误:[$ injector:nomod]模块' ui.grid'不可用! You either misspelled the module name or forgot to load it. 您可能拼错了模块名称,或者忘记了加载它。 If registering a module ensure that you specify the dependencies as the second argument. 如果注册模块,请确保将依赖项指定为第二个参数。

<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="MyApp"> <head><title></title>
<link href="Content/bootstrap.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="ng-grid.css" />
<script src="Scripts/jquery-1.9.1.js"></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/angular.js"></script>
<script src="Scripts/angular-route.js"></script>
<script type="text/javascript" src="ng-grid-1.3.2.js"></script>
<script src="app.js"></script>
<script src="service.js"></script>
<script src="controller.js"></script>

does any body have a clue on how to inject ngGrid and use it in angularjs application? 有没有人知道如何注入ngGrid并将其在angularjs应用程序中使用?

Thanks. 谢谢。

Add ng-grid JS file to your project: 将ng-grid JS文件添加到您的项目中:

<head lang="en">
    <link rel="stylesheet" type="text/css" href="ng-grid.css" />
    <script type="text/javascript" src="angular.js"></script>
    <script type="text/javascript" src="ng-grid-1.3.2.js"></script>
</head>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM