Utilisation du ng-table d'angular JS

Par rimi, il y a 9 ans


Bonjour,
je voudrais intégrer le module ng-table d'angular.alors je l'ai installer ensuite j'ai essayé d'appliquer l'example suivant mais j'ai eu cette erreur dans le console :
Error: [$injector:modulerr] Failed to instantiate module testTApp due to:
[$injector:modulerr] Failed to instantiate module ngTable due to:
[$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.3/$injector/nomod?p0=ngTable
minErr/<@http://localhost:9000/bower_components/angular/angular.js:66:12
module/<@http://localhost:9000/bower_components/angular/angular.js:2257:17
ensure@http://localhost:9000/bower_components/angular/angular.js:2178:38
module@http://localhost:9000/bower_components/angular/angular.js:2255:14
loadModules/<@http://localhost:9000/bower_components/angular/angular.js:4896:22
forEach@http://localhost:9000/bower_components/angular/angular.js:402:11
loadModules@http://localhost:9000/bower_components/angular/angular.js:4880:5
loadModules/<@http://localhost:9000/bower_components/angular/angular.js:4

17 réponses

rimi, il y a 9 ans

non je l'avais mis sauf que au moment ou je lance grunt serve ,il le supprime automatiquement et je savais pas pourquoi!!!

rimi, il y a 9 ans

j'ai crée un new project ,coté grunt y a pas de problème mais l'erreur cote ng-table reste toujours

betaWeb, il y a 9 ans

Donc c'est que le souci vient de Grunt.

betaWeb, il y a 9 ans

je ne comprends rien à ton code... ton script contenant ton application AngularJS est appelé avant ou après celui contenant ngTable ?

rimi, il y a 9 ans
<link rel="stylesheet" href="styles/main.css"> <!-- endbuild --> <!-- 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-sass-official/assets/javascripts/bootstrap.js"></script> <!-- endbower --> <!-- endbuild --> <!-- build:js({.tmp,app}) scripts/scripts.js --> <script src="scripts/app.js"></script> <script src="scripts/controllers/main.js"></script> <!-- endbuild -->
betaWeb, il y a 9 ans

A quel endroit charge-tu la dépendance "ngTable" ?

betaWeb, il y a 9 ans

Salut,

As-tu injecté le module à ton app ? Car je pense que le souci vient de là.

rimi, il y a 9 ans

Oui ,je le fais comme ceci
angular
.module('testTApp', ["ngTable"]);

Mais ne fonctionne pas toujours

betaWeb, il y a 9 ans

Es-tu sûr que le script est bien chargé et surtout chargé avant d'initialiser AngularJS ?

rimi, il y a 9 ans

c'est à dire ?

betaWeb, il y a 9 ans

Lorsque tu charges tes scripts dans ta page, dans quel ordre les charges-tu ?

rimi, il y a 9 ans

comme ça :
<link rel="stylesheet" href="styles/main.css">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>

rimi, il y a 9 ans

voilà mes nouvelles erreurs :

GET http://localhost:9000/node_modules/ng-table/bundles/ng-table.js [HTTP/1.1 404 Not Found 53ms] GET http://localhost:35729/livereload [HTTP/1.1 101 Switching Protocols 59ms] Error: [$injector:modulerr] Failed to instantiate module testNgTableApp due to: [$injector:modulerr] Failed to instantiate module ngTable due to: [$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.3/$injector/nomod?p0=ngTable minErr/<@http://localhost:9000/bower_components/angular/angular.js:66:12 module/<@http://localhost:9000/bower_components/angular/angular.js:2257:17 ensure@http://localhost:9000/bower_components/angular/angular.js:2178:38 module@http://localhost:9000/bower_components/angular/angular.js:2255:14 loadModules/<@http://localhost:9000/bower_components/angular/angular.js:4896:22 forEach@http://localhost:9000/bower_components/angular/angular.js:402:11 loadModules@http://localhost:9000/bower_components/angular/angular.js:4880:5 loadModules/<@http://localhost:9000/bower_components/angular/angula angular.js:66:12
rimi, il y a 9 ans

oui ,mais le problème que je l'ai chargé mais je vois pas comment faire maintenant?

Lartak, il y a 9 ans

Bonsoir.
Comment tu fais pour ne pas comprendre le problème ?

http://localhost:9000/node\_modules/ng-table/bundles/ng-table.js [HTTP/1.1 404 Not Found 53ms]

Il est tout simplement spécifié que le fichier ne peut pas être trouvé dans le chemin spécifié.
Tu devrais quand même être capable de comprendre cette erreur.

rimi, il y a 9 ans

@Lartak j'avais bien compris le problème du mon programme sauf que je vois d'ou vient ce problème car la config me semble correcte

betaWeb, il y a 9 ans

Elle te semble l'être mais elle ne l'est pas. Donc revérifie bien tout.
J'ajouterais même que, dans 99.99999% des cas, la source du bug se trouve entre la chaise et le clavier.