Angularjs 应用程序中的 ngTable
ngTable in Angularjs application
我在我的 angularjs 应用程序中使用 ngtable 但是在进行 grunt 构建时,引用丢失并且显示错误
Uncaught Error: [$injector:modulerr] Failed to instantiate module parts360App due to:
Error: [$injector:modulerr] Failed to instantiate module ngTable due to:
Error: [$injector:nomod] Module 'ngTable' is not available! 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.
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=ngTable
at http://localhost:9000/bower_components/angular/angular.js:66:12
我正在使用的 table - http://ng-table.com/#/
bower install ng-table --save
bower.json 已更新,但 table 的参考在 index.html
中不可用
我也尝试过使用 npm,但它在命令提示符下显示错误:
+-- UNMET PEER DEPENDENCY angular@^1.2
`-- ng-table@3.0.1
npm WARN ng-table@3.0.1 requires a peer of angular@^1.2 but none was installed.
这是我的 bower.json:
{
"name": "parts360",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"bootstrap": "^3.2.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-bootstrap": "^2.5.0",
"angular-busy": "^4.1.4",
"ng-table": "^3.0.1"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "parts360App",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
}
}
请建议如何解决此问题以获取 index.html
中的引用
喜欢其他人:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-busy/dist/angular-busy.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
很遗憾,ng-table 在 Bower 上不再受支持。
您可以在他们的 github 上找到所有 UpToDate installations methods。
如果你真的想/必须使用 bower,你可以使用:
bower install ng-table-bundle
并添加对它的引用,就像其他 Bower 组件一样:
<script src="bower_components/ng-table-bundle/ng-table.min.js"></script>
我在我的 angularjs 应用程序中使用 ngtable 但是在进行 grunt 构建时,引用丢失并且显示错误
Uncaught Error: [$injector:modulerr] Failed to instantiate module parts360App due to:
Error: [$injector:modulerr] Failed to instantiate module ngTable due to:
Error: [$injector:nomod] Module 'ngTable' is not available! 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.
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=ngTable
at http://localhost:9000/bower_components/angular/angular.js:66:12
我正在使用的 table - http://ng-table.com/#/
bower install ng-table --save
bower.json 已更新,但 table 的参考在 index.html
中不可用我也尝试过使用 npm,但它在命令提示符下显示错误:
+-- UNMET PEER DEPENDENCY angular@^1.2
`-- ng-table@3.0.1
npm WARN ng-table@3.0.1 requires a peer of angular@^1.2 but none was installed.
这是我的 bower.json:
{
"name": "parts360",
"version": "0.0.0",
"dependencies": {
"angular": "^1.4.0",
"bootstrap": "^3.2.0",
"angular-resource": "^1.4.0",
"angular-route": "^1.4.0",
"angular-bootstrap": "^2.5.0",
"angular-busy": "^4.1.4",
"ng-table": "^3.0.1"
},
"devDependencies": {
"angular-mocks": "^1.4.0"
},
"appPath": "app",
"moduleName": "parts360App",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
}
}
请建议如何解决此问题以获取 index.html
中的引用喜欢其他人:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-busy/dist/angular-busy.js"></script>
<!-- endbower -->
<!-- endbuild -->
<!-- build:js({.tmp,app}) scripts/scripts.js -->
很遗憾,ng-table 在 Bower 上不再受支持。
您可以在他们的 github 上找到所有 UpToDate installations methods。
如果你真的想/必须使用 bower,你可以使用:
bower install ng-table-bundle
并添加对它的引用,就像其他 Bower 组件一样:
<script src="bower_components/ng-table-bundle/ng-table.min.js"></script>