Reputation: 437
I'm new to AngularJS and Smart Table...I'm trying to work through a simple Smart Table example, but for some reason I can't seem to get my table data to display.
Here is my html:
<body ng-controller="basicsCtrl">
<p>Hello {{name}}!</p>
<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>
</body>
Here is my js:
var app = angular.module('myApp', ['smartTable.table']);
app.controller('basicsCtrl', ['$scope', function (scope) {
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]'}
];
scope.name = "World";
}]);
Here is my plunker code: http://plnkr.co/edit/335mfrwqHQXewqXJ4N0I?p=preview
Thanks!
Shanna
Upvotes: 1
Views: 2668
Reputation: 41
having a similar problem with the same example. What do u mean re-order my script tags?
<script src="scripts/NonLibScripts/ScheduleScript.js"></script>
<script src="scripts/NonLibScripts/DataScript.js"></script>
Is this not sufficient? I am trying to populate the smart table data from the DataScript.
Upvotes: 1
Reputation: 1889
easy fix
change this line:
var app = angular.module('myApp', ['smartTable.table']);
to this:
var app = angular.module('myApp', ['smart-table']);
and reorder your script tags in the index file so that angular is before smart table
here is the updated plunk http://plnkr.co/edit/vHCbrN0cKDplxqwT78kf?p=preview
Upvotes: 3