user3413723
user3413723

Reputation: 12243

Can't get md-data-table directives to work

I'm trying to include https://github.com/daniel-nagy/md-data-table in my page, but for some reason it's not working. None of the directives do anything! Here's what I have so far - can anyone see what I've missed. I have already checked in chrome and confirmed that the library is loading.

<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>

My Controller:

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
  };


}

And the app:

angular.module('mymaps', ['ngMaterial', 'md.data.table', 'ngMessages'])

Upvotes: 1

Views: 1146

Answers (1)

jeremy-denis
jeremy-denis

Reputation: 6878

you inject the md.data.table in your module mymaps but you also to add it in your mapnotes module

angular.module('mapnotes', ['md.data.table'])

Upvotes: 2

Related Questions