1
votes

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

  1. installed smart-table

    bower install angular-smart-table

    npm install

  2. Added smart-table dependency in config.js

    var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'smart-table'];

  3. Added location of smart-table js in env/all.js

'public/lib/angular-smart-table/smart-table.js'

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

1

1 Answers

1
votes

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.