我试图在我的网页中加入https://github.com/daniel-nagy/md-data-table,但由于某种原因,它无效。这些指令都没有做任何事情!这是我迄今为止所拥有的 - 任何人都能看到我错过的东西。我已经检查了chrome并确认该库正在加载。
<div ng-controller="MapsCtrl as vm">
<md-table-container>
<table md-table md-row-select multiple ng-model="vm.selected" md-progress="promise">
<thead md-head md-order="query.order" md-on-reorder="getDesserts">
<tr md-row>
<th md-column md-order-by="vm.mapName"><span>Map Name</span></th>
<th md-column>Map Id</th>
</tr>
</thead>
<tbody md-body>
<tr md-row md-select="vm.dessert" md-select-id="name" md-auto-select ng-repeat="map in vm.maps">
<td md-cell>{{map.name}}</td>
<td md-cell>{{map._id}}</td>
</tr>
</tbody>
</table>
</md-table-container>
<md-table-pagination md-limit="query.limit" md-limit-options="[5, 10, 15]" md-page="query.page" md-total="{{desserts.count}}"
md-on-paginate="getDesserts" md-page-select></md-table-pagination>
</div>
我的控制器:
angular.module("mymaps").controller('MapsCtrl',MapsCtrl);
//Inject dependencies here for minification.
MapsCtrl.$inject = ["userService", '$http', '$mdDialog',"$scope"];
//This is the actual controller
function MapsCtrl(userService,$http, $mdDialog, $scope){
var vm = this;
vm.maps = [
{_id:1,name:"Map 1"},
{_id:2,name:"Map 3"},
{_id:3,name:"Map 3"}
];
$scope.selected = [];
$scope.query = {
order: 'name',
limit: 5,
page: 1
};
}
应用程序:
angular.module('mymaps', ['ngMaterial', 'md.data.table', 'ngMessages'])
答案 0 :(得分:2)
你在模块mymaps中注入了md.data.table,但你也要在mapnotes模块中添加它
angular.module('mapnotes', ['md.data.table'])