嘗試使用角度數據表時出現下一個錯誤。角度數據表導出錯誤
我都用文件夾的設置建議,我遵循網站的抽樣http://l-lin.github.io/angular-datatables/archives/#/gettingStarted
的誤差在從角datatables.js下一行:
export { DataTablesModule } from './angular-datatables.module';
export { DataTableDirective } from './angular-datatables.directive';
HTML:
<div ng-app='clinang' ng-controller="pacientesCtrl">
<h4>Cadastro de pacientes</h4>
<table datatable="" dt-options="pacientesCtrl.dtOptions" dt-columns="pacientesCtrl.dtColumns" class="row-border hover"></table>
</div>
這裏是我的JS:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="files/lib/bootstrap/bootstrap.js"></script>
<!-- Latest compiled and minified JavaScript -->
<link rel="stylesheet" href="files/lib/bootstrap/bootstrap.css" >
<script src="files/lib/angular/angular.js"></script>
<script src="files/lib/angular-datatables/angular-datatables.js"></script>
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<script src="files/lib/bootstrap/ui-bootstrap-tpls-2.5.0.js"></script>
<link href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="files/lib/angular-datatables/angular-datatables.css">
<script src="files/js/controllers/pacientesCtrl.js"></script>
<script type="text/javascript">
angular.module('clinang',[]);
angular.module('clinang', ['ui.bootstrap','datatables']);
</script>
個
pacientesCtrl.js:
angular.module('clinang').controller('pacientesCtrl', function (DTOptionsBuilder, DTColumnBuilder) {
var vm = this;
vm.dtOptions = DTOptionsBuilder.fromSource('/getdadospac/?oper=S')
.withPaginationType('full_numbers');
vm.dtColumns = [
DTColumnBuilder.newColumn('pront').withTitle('pront'),
DTColumnBuilder.newColumn('nome').withTitle('Nome'),
DTColumnBuilder.newColumn('endereco').withTitle('Endereço').notVisible()
];
});
錯誤:
angular-datatables.js:12 Uncaught SyntaxError: Unexpected token export
angular.js:4759 Uncaught Error: [$injector:modulerr] Failed to instantiate module clinang due to:
Error: [$injector:modulerr] Failed to instantiate module datatables due to:
Error: [$injector:nomod] Module 'datatables' 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.1/$injector/nomod?p0=datatables
at http://127.0.0.1:8888/files/lib/angular/angular.js:68:12
at http://127.0.0.1:8888/files/lib/angular/angular.js:2183:17
at ensure (http://127.0.0.1:8888/files/lib/angular/angular.js:2107:38)
at module (http://127.0.0.1:8888/files/lib/angular/angular.js:2181:14)
at http://127.0.0.1:8888/files/lib/angular/angular.js:4736:22
at forEach (http://127.0.0.1:8888/files/lib/angular/angular.js:357:20)
at loadModules (http://127.0.0.1:8888/files/lib/angular/angular.js:4720:5)
at http://127.0.0.1:8888/files/lib/angular/angular.js:4737:40
at forEach (http://127.0.0.1:8888/files/lib/angular/angular.js:357:20)
at loadModules (http://127.0.0.1:8888/files/lib/angular/angular.js:4720:5)
http://errors.angularjs.org/1.6.1/$injector/modulerr?p0=datatables&p1=Error%3A%20%5B%24injector%3Anomod%5D%20Module%20'datatables'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.6.1%2F%24injector%2Fnomod%3Fp0%3Ddatatables%0A%20%20%20%20at%20http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A68%3A12%0A%20%20%20%20at%20http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A2183%3A17%0A%20%20%20%20at%20ensure%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A2107%3A38)%0A%20%20%20%20at%20module%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A2181%3A14)%0A%20%20%20%20at%20http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A4736%3A22%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A357%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A4720%3A5)%0A%20%20%20%20at%20http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A4737%3A40%0A%20%20%20%20at%20forEach%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A357%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2F127.0.0.1%3A8888%2Ffiles%2Flib%2Fangular%2Fangular.js%3A4720%3A5)
at http://127.0.0.1:8888/files/lib/angular/angular.js:68:12
at http://127.0.0.1:8888/files/lib/angular/angular.js:4759:15
at forEach (http://127.0.0.1:8888/files/lib/angular/angular.js:357:20)
at loadModules (http://127.0.0.1:8888/files/lib/angular/angular.js:4720:5)
at http://127.0.0.1:8888/files/lib/angular/angular.js:4737:40
at forEach (http://127.0.0.1:8888/files/lib/angular/angular.js:357:20)
at loadModules (http://127.0.0.1:8888/files/lib/angular/angular.js:4720:5)
at createInjector (http://127.0.0.1:8888/files/lib/angular/angular.js:4642:19)
at doBootstrap (http://127.0.0.1:8888/files/lib/angular/angular.js:1838:20)
at bootstrap (http://127.0.0.1:8888/files/lib/angular/angular.js:1859:12)
http://errors.angularjs.org/1.6.1/$injector/modulerr?p0=clinang&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20Failed%20to%20instantiat......
面臨着同樣的問題。任何解決方案 –
嗨,直到現在,我還沒有解決方案。 –