Reputation: 13
I have built a basic application form meanjs boilerplate code and trying to inject smart-table to display table data Below are the changes I have made but not sure why its not working
installed smart-table
bower install angular-smart-table
npm install
Added smart-table dependency in config.js
var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'smart-table'];
Added location of smart-table js in env/all.js
'public/lib/angular-smart-table/smart-table.js'
Modified the controller.js to add smart-table as dependncy
angular.module('exceptions' ,['smart-table']).controller(.....
After step 4 my module does not get loaded I had tried with modifying client.module.js with adding below line as well but no luck
ApplicationConfiguration.registerModule('smart-table');
Can anyone please point me if I am missing anything or right way to inject 3rd party modules in MEANJS
Upvotes: 1
Views: 823
Reputation: 2426
Step four is not necessary. Try this.
In your controller dummy data.
$scope.rowCollection = [
{firstName: 'Laurent', lastName: 'Renard', birthDate: new Date('1987-05-21'), balance: 102, email: '[email protected]'},
{firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: '[email protected]'},
{firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: '[email protected]'}
];
In your html
<table st-table="rowCollection" class="table table-striped">
<thead>
<tr>
<th>first name</th>
<th>last name</th>
<th>birth date</th>
<th>balance</th>
<th>email</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rowCollection">
<td>{{row.firstName}}</td>
<td>{{row.lastName}}</td>
<td>{{row.birthDate}}</td>
<td>{{row.balance}}</td>
<td>{{row.email}}</td>
</tr>
</tbody>
</table>
I tried this with meanjs stack and works fine for me.
Upvotes: 1