我有点新的角度和全新的角度-数据模块。然而,角-DT的文档并不适用于我。
按照指示,我通过Bower安装了角数据,在我的index.html中包含了JS文件,并在我的模块中声明了依赖关系。下面是我的controller.js文件的内容:
'use strict';
/* Controllers */
angular.module('myApp.controllers', ['datatables'])
.controller('MyCtrl1', ['$scope', function($scope) {
}])
.controller('MyCtrl2', ['$scope', function($scope) {
}]);下面是Paral1.html文件中的表:
<table datatable="">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Foo</td>
<td>Bar</td>
</tr>
<tr>
<td>123</td>
<td>Someone</td>
<td>Youknow</td>
</tr>
<tr>
<td>987</td>
<td>Iamout</td>
<td>Ofinspiration</td>
</tr>
</tbody>
</table>这是我的index.html:
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <
![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>DataTables: Bach</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
<!--datatables style-->
<link rel="stylesheet" href="//cdn.datatables.net/1.10.1/css/jquery.dataTables.css">
<link rel="stylesheet" href="css/app.css"/>
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<ul class="menu">
<li><a href="#/view1">view1</a></li>
<li><a href="#/view2">view2</a></li>
</ul>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div ng-view></div>
<!-- In production use:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
-->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>
<!--jquery-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!--datatables-->
<script src="//cdn.datatables.net/1.10.1/js/jquery.dataTables.js"></script>
<!--angular-datatables-->
<script src="bower_components/angular-datatables/dist/angular-datatables.js"></script>
</body>
</html>我的浏览器显示一个普通的表,在表下面显示一条消息:加载.
我正在使用与零配置。文档中的示例非常相似的代码,有人知道我可能遗漏了什么吗?提前感谢!
发布于 2014-08-20 01:30:30
这个问题是由您的脚本排序引起的--应该是Jquery,Jquery-Datatable,角,角-Datatables,然后是应用程序脚本。
如果你把角度第一,你得到了你描述的装载错误-我同意,它可以更多地描述在文档中。
https://stackoverflow.com/questions/24832722
复制相似问题