【问题标题】:smart table not displaying智能表不显示
【发布时间】:2015-08-05 17:00:37
【问题描述】:

我是 AngularJS 和 Smart Table 的新手...我正在尝试完成一个简单的 Smart Table 示例,但由于某种原因,我似乎无法显示我的表格数据。

这是我的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>

这是我的 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: 'whatever@gmail.com'},
        {firstName: 'Blandine', lastName: 'Faivre', birthDate: new Date('1987-04-25'), balance: -2323.22, email: 'oufblandou@gmail.com'},
        {firstName: 'Francoise', lastName: 'Frere', birthDate: new Date('1955-08-27'), balance: 42343, email: 'raymondef@gmail.com'}
    ];
    scope.name = "World";
}]);

这是我的 plunker 代码: http://plnkr.co/edit/335mfrwqHQXewqXJ4N0I?p=preview

谢谢!

夏娜

【问题讨论】:

    标签: angularjs smart-table


    【解决方案1】:

    轻松解决

    改变这一行:

    var app = angular.module('myApp', ['smartTable.table']);
    

    到这里:

    var app = angular.module('myApp', ['smart-table']);
    

    并重新排序索引文件中的脚本标签,使角度在智能表之前

    这里是更新的 plunk http://plnkr.co/edit/vHCbrN0cKDplxqwT78kf?p=preview

    【讨论】:

    • 不客气!请将此标记为正确答案!
    【解决方案2】:

    同一个例子也有类似的问题。你是什​​么意思重新排序我的脚本标签?

    <script src="scripts/NonLibScripts/ScheduleScript.js"></script>
    <script src="scripts/NonLibScripts/DataScript.js"></script>
    

    这还不够吗?我正在尝试从 DataScript 填充智能表数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 2015-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多