Javascript 在控制器中使用角度数据表DTOptions
我正在一个项目中使用。我是这样使用它的:Javascript 在控制器中使用角度数据表DTOptions,javascript,angularjs,datatable,Javascript,Angularjs,Datatable,我正在一个项目中使用。我是这样使用它的: <table datatable="ng" class="table table-bordered"> <thead> <tr> <th>ID</th> <th>First</th> <th>Last</th> <th>Occupation</th> <
<table datatable="ng" class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>First</th>
<th>Last</th>
<th>Occupation</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in people">
<td>{{person.Id}}</td>
<td>{{person.FirstName}}</td>
<td>{{person.LastName}}</td>
<td>{{person.Job}}</td>
</tr>
</tbody>
</table>
MyApp是手动引导的,因为页面上有多个应用app.js
具有以下功能:
<link href="/libs/datatables/media/css/jquery.dataTables.min.css" rel="stylesheet"/>
<link href="/libs/angular-datatables/dist/datatables.bootstrap.min.css" rel="stylesheet"/>
<script src="/libs/jquery/dist/jquery.min.js"></script>
<script src="/libs/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="/libs/angular/angular.min.js"></script>
<script src="/libs/angular-datatables/dist/angular-datatables.min.js"></script>
<script src="/js/app.js"></script>
angular.bootstrap($('#myApp'), ['myApp']);
'use strict';
var myApp = angular.module('myApp', ['ngAnimate', 'ui.bootstrap', 'datatables', 'app.components']);
myApp.controller('MyController', ['$scope',
function ($scope, DTOptionsBuilder, DTColumnDefBuilder) {
console.log(DTOptionsBuilder);
}])
;
console.log语句打印未定义的
。这对我来说意味着没有加载datatables
。然而,我不知道如何证实这一点。我在控制台窗口中没有看到任何404。所以,我假设我至少下载了必要的库。感觉好像我没有正确地注入数据表。然而,在我看来这是正确的。但是,排序不起作用,DTOptionsBuilder
打印未定义
我做错了什么?未正确提供内联数组批注
正确的方法是:
myApp.controller('MyController',['$scope','DTOptionsBuilder','DTColumnDefBuilder',',
函数($scope、DTOptionsBuilder、DTColumnDefBuilder){
console.log(DTOptionsBuilder);
}])
;代码>