ng2-table中没有默认样式

时间:2017-04-20 09:23:31

标签: angular material-design

我安装了ng表,并使用教程添加一些数据:

http://valor-software.com/ng2-table/

但是我在这篇文章中简化了表格: Ng2-table not working with latest Angular2 version

数据正确显示,但我注意到桌子上没有STYLE(没有边框,没有颜色),结果与使用相同

<table> 
(... ) 
 </table>

没有CSS。

html:

<div>
    <ng-table
      [columns]="columns"
      [rows]="rows">
    </ng-table>
  </div>

dashboard.ts;

export class DashboardComponent implements OnInit {

  errorMessage: string;
  interfacesBrief: InterfaceBrief[];
  columns: any;
  rows: any;

  constructor(private _service: AuthService, private _emotService: EmotClientService) {
  }

  ngOnInit() {
    this.columns = [
      {title: "Client", name: "client"},
      {title: 'Module', name: "module"},
      {title: 'Target', name: 'target'},
      {title: 'Source', name: 'source'},
      {title: 'Count OK', name: 'countOK'},
      {title: 'Count KO', name: 'countKO'}]
    this.getInterfaces();
  }

  getInterfaces() {
    this._emotService.getInterfaces().subscribe(
      data => {
        this.interfacesBrief = data;
        this.rows = this.interfacesBrief;
        console.log(this.interfacesBrief, "Without Error")
      },
      error => this.errorMessage = <any>error
    );
  }

1 个答案:

答案 0 :(得分:0)

ng2-table正在使用引导程序进行样式设置。 确保将引导程序导入到您的项目中。

以下是有关如何以角度https://loiane.com/2017/08/how-to-add-bootstrap-to-an-angular-cli-project/#2-installing-bootstrap-from-npm导入引导程序的链接。