具有Angular 2/4的NgTable

时间:2017-06-06 08:11:25

标签: angular ngtable

我试图为Angular 2/4创建一个表格,但是我在运行App时出错了。 我的Ts文件:

import { Component, OnInit } from '@angular/core';
import { NgTableParams } from 'ng-table';

@Component({
  selector: 'app-folders',
  templateUrl: './folders.component.html',
  styleUrls: ['./folders.component.css']
})
export class FoldersComponent implements OnInit {
  folders: any = {};
  result: any = [];
  tableParamsFolders = {};
  constructor() { }

  ngOnInit() {
    this.foldersService.getAllFolders().subscribe(
      result => {
        this.result = result;
        this.tableParamsFolders = new NgTableParams({count : 10, page : 1}, {dataset: this.result});
      });
  }
}

在我的html组件中,我尝试了这个:

 <div class="row">
          Show  1 to {{tableParamsFolders.settings().total}} on {{tableParamsFolders.settings().total}}
            <table ng-table="tableParamsFolders" show-filter="false">
                <thead>
                <tr>
                    <th class="sortable col-md-2 sort-desc">
                        <div class="sort-indicator">N°</div>
                    </th>
                    <th class="sortable col-md-1">
                        <div class="sort-indicator">Type</div>
                    </th>
                </tr>
                </thead>
                <tbody class="clickable">
                    <tr *ngFor="let frnd of result">
                        <td data-title="'No'" filter="{ 'no': 'text' }" sortable="no">
                        {{frnd.ID}}
                         </td>
                        <td data-title="'Type'" filter="{ 'type': 'text' }" sortable="type">
                        </td>
                    </tr>
                </tbody>
            </table>

        </div>

我收到了附件文件的错误.. 分页没有显示.. 如果有人在Angular 2/4中有使用ngTable的问题或链接 and other empty values

0 个答案:

没有答案