0

我看到计算器上的很多帖子,出现此错误:未知的提供NgTableParamsProvider < - NgTableParams

Error: [$injector:unpr] Unknown provider: NgTableParamsProvider <- NgTableParams 
http://errors.angularjs.org/1.5.8/$injector/unpr?p0=NgTableParamsProvider%20%3C-%20NgTableParams 
at http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:33767:12 
at http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38210:19 
at Object.getService [as get] (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38363:39) 
at http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38215:45 
at getService (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38363:39) 
at injectionArgs (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38387:58) 
at Object.invoke (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:38409:18) 
at $controllerInit (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:44053:34) 
at nodeLinkFn (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:42962:34) 
at compositeLinkFn (http://localhost:3000/packages/modules.js?hash=5b256037162d84065d102fdba9b374faa45dbd89:42319:13) <div ui-view="" class="ng-scope" data-ng-animate="1"> 

他们中的大多数似乎与ñ gTableParams第一大写有关。那么,我照顾这个。但它不工作:-(面向我在我的例子为ngTable从这里:https://github.com/esvit/ng-table/tree/master/demo-apps/es6-webpack

这是我的代码:?

import angular from 'angular'; 
import angularMeteor from 'angular-meteor'; 
import uiRouter from 'angular-ui-router'; 
import template from './view1.html'; 
import angularCharts from 'angular-chart.js'; 
import ngTable from 'ng-table'; 

const name = 'view1'; 

class View1 { 
constructor($interval, $scope, $reactive, NgTableParams) { 
    'ngInject'; 

//some code skipped 

    var data = [ 
     { name: "Moroni", age: 50 }, 
     { name: "Tiancum", age: 43 }, 
     { name: "Jacob", age: 27 }, 
     { name: "Nephi", age: 29 }, 
     { name: "Enos", age: 34 }, 
     { name: "Tiancum", age: 43 }, 
     { name: "Jacob", age: 27 }, 
     { name: "Nephi", age: 29 }, 
     { name: "Enos", age: 34 }, 
     { name: "Tiancum", age: 43 }, 
     { name: "Jacob", age: 27 }, 
     { name: "Nephi", age: 29 }, 
     { name: "Enos", age: 34 }, 
     { name: "Tiancum", age: 43 }, 
     { name: "Jacob", age: 27 }, 
     { name: "Nephi", age: 29 }, 
     { name: "Enos", age: 34 } 
    ]; 

    this.tableParams = new NgTableParams({}, { 
     dataset: data 
    }); 
.... 

} 
View1.$inject = ['NgTableParams']; 

export default angular.module(name, [ 
angularMeteor, 
angularCharts, 
uiRouter, 
]).component(name, { 
ngTable, 
template, 
controllerAs: name, 
controller: View1 
}) 

.config(config); 

function config($stateProvider) { 
'ngInject'; 
$stateProvider 
    .state('view1', { 
     url: '/Allgemein', 
     template: '<view1></view1>' 
    }); 
} 

我怎样才能解决这个错误或许这是与我怎么想$注入NgTableParams

编辑:更新我的代码就像@Sajeetharan说后,我得到这个错误:

[$injector:modulerr] Failed to instantiate module main due to: 
Error: [$injector:modulerr] Failed to instantiate module view1 due to: 
Error: [$injector:modulerr] Failed to instantiate module {"ngTable":{"_invokeQueue":[],"_configBlocks":[],"_runBlocks":[],"requires":["ngTable-core","ngTable-browser"],"name":"ngTable"},"default":{"_invokeQueue":[["$provide","provider",{"0":"ngTableDefaultGetData"}],["$provide","value",{"0":"ngTableDefaults","1":{"params":{},"settings":{}}}],["$provide","factory",{"0":"NgTableParams"}],["$provide","factory",{"0":"ngTableEventsChannel"}]],"_configBlocks":[],"_runBlocks":[],"requires":[],"name":"ngTable-core"}} due to: 
Error: [ng:areq] Argument 'module' is not a function, got Object 

这是错误涉及到我,我看看就像现在模块里面有一个错误:D。

EDIT2:

在你(@Sajeetharan)例如添加引号的所有模块,如后:

[$injector:modulerr] Failed to instantiate module main due to: 
Error: [$injector:modulerr] Failed to instantiate module view1 due to: 
Error: [$injector:modulerr] Failed to instantiate module angularMeteor due to: 
Error: [$injector:nomod] Module 'angularMeteor' 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.5.8/$injector/nomod?p0=angularMeteor 

他不能再找到角流星? 我删除了除ngTables之外的所有模块中的引号。然后我得到这个错误:

TypeError: $reactive is not a function 
at new View1 (http://localhost:3000/app/app.js?hash=cbd80421227e67667ccffb8b9f1fa2dd725c17fc:272:9) 
at Object.invoke (http://localhost:3000/packages/modules.js? 

我使用助手的一些数据。我用$ reactive做这个:$reactive(this).attach($scope);

对于测试,我删除了$ reactive。但后来他告诉我,那Ngtableparams不是一个构造器-.-:

TypeError: NgTableParams is not a constructor 
at new View1 (http://localhost:3000/app/app.js?hash=24ffbded787373a46d708b60a31466c47e1b756d:404:28) 
at Object.invoke (http://localhost:3000/packages/modules.js? 

我希望你还是要帮我这一切的错误:-(

回答

0

你需要注入ngTable您模块,

export default angular.module(name, [ 
'angularMeteor', 
'angularCharts', 
'uiRouter', 
'ngTable' 
]) 
+0

谢谢您的回答!我更新了我的第一篇文章。不幸的是,它抛出一个新的错误,请查看错误 – tiga05

+0

其实你应该把报价 – Sajeetharan

+0

内的依赖性是的,我更新了我的代码和我第一篇文章,它仍然没有工作.... – tiga05

相关问题